Hash
Using certutil (CMD)
certutil -hashfile file.txt MD5
MD5 hash of a file.
certutil -hashfile file.txt SHA1
SHA1 hash of a file.
certutil -hashfile file.txt SHA256
SHA256 hash of a file.
certutil -hashfile file.txt SHA384
SHA384 hash of a file.
certutil -hashfile file.txt SHA512
SHA512 hash of a file.
ForFiles (CMD)
forfiles /m <file_pattern> /c "cmd /c certutil -hashfile @file SHA1"
Loop through multiple files in directories and compute SHA1 hash for each file.
forfiles /m *.txt /c "cmd /c certutil -hashfile @file SHA1"
Example of computing SHA1 hash for each .txt file in the current directory.
Using Get-FileHash (PowerShell)
Get-FileHash -Path file.txt -Algorithm MD5
Computes the MD5 hash of a specified file.
Get-FileHash -Path file.txt -Algorithm SHA1
Computes the SHA1 hash of a specified file.
Get-FileHash -Path file.txt -Algorithm SHA256
Computes the SHA256 hash of a specified file.
Get-FileHash -Path file.txt -Algorithm SHA384
Computes the SHA384 hash of a specified file.
Get-FileHash -Path file.txt -Algorithm SHA512
Computes the SHA512 hash of a specified file.
Hashing multiple files (PowerShell)
MD5 hash for all .txt files in a directory:
SHA256 hash for all .txt files in a directory:
These commands allow you to compute hashes of files using various algorithms, providing a way to verify file integrity or uniqueness in Windows environments.
Last updated
Was this helpful?