Since Windows NT6, Windows started to include certification utility. This file is called “certutil.exe”. You may call it through Windows command line.
File hashing is significantly important in file checking to make sure it is not corrupted. To perform file hashing, you will need to execute following command line:
certutil -hashfile [Target File Path] [Algorithm]
For example, if you want to hash a file in “D:\test.txt” with MD5 algorithm, you are supposed to execute command line:
certutil -hashfile "D:\test.exe" MD5
In order to integrate this function to right-click button, you should write batch program and edit registry.
For batch program, you should write the following code:
@echo off title Hash File with SHA-1 Algorithm echo Hash File with SHA-1 Algorithm echo Powered by firstname.lastname@example.org echo ============Start Hashing============ certutil -hashfile %1 SHA1 echo ============Hash Complete============ pause
Save the code to C:\Windows\hashsha1.bat
Next, we should edit the registry. To simplify your work and make your editing safer, we are going to create a registry file.
Create a “*.reg” file, and put the following code:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\GetSHA1] @="Hash File with SHA-1 Algorithm" [HKEY_CLASSES_ROOT\*\shell\GetMD5\command] @="\"C:\\Windows\\hashsha1.bat\" \"%1\""
Execute the registry editor file. Then the right-click button would start to work.
For an example, we download Notepad++ from internet. We selected to download Notepad v7.6.4 x64 installer. From official Notepad++ website, the expected SHA-1 hash result is:
You may check this from website link:
We click on the right-click button. A command line windows pops up:
You may notice that the most complex algorithm that certutil supports is the SHA-512 algorithm.