Generate Hash of File using Certutil on Windows

Generate Hash of File using Certutil on Windows

Certutil is a command line tool that allows to perform various operations related with digital certificates on Windows. Certutil also allows to generate hash of a file such as MD4, MD5, etc. It can be useful to check that the file has not been altered during transfer over the network. This tutorial demonstrates how to generate a hash of a file using Certutil on Windows.

Create a new file for testing:

echo | set /p="Hello world"> test.txt

Note that command prints text without a new line.

To generate a MD5 hash of the file and print the result in the terminal, run the following command:

certutil -hashfile test.txt MD5

Output:

MD5 hash of test.txt:
3e25960a79dbc69b674cd4ec67a72c62
CertUtil: -hashfile command completed successfully.

To write the result to a file, use the > redirection operator:

certutil -hashfile test.txt MD5 > test.md5

Certutil supports the following cryptographic hash functions: MD2, MD4, MD5, SHA1, SHA256, SHA384, SHA512.

Leave a Comment

Cancel reply

Your email address will not be published.