Monday, August 3, 2015

Computing MD5 and SHA1 Hashes in Windows

Did you know that Windows has a tool to calculate MD5 and SH1 hashes of files?  It's not widely known, partial because it's not included in the default install.  It is a free download from Microsoft though:

https://www.microsoft.com/en-us/download/details.aspx?id=11533

By default it calculates the MD5 hash of a file and looks something like this:


You can also have it output the SHA1 hash or both at the same time with -sha1 or -both.  You can also integrate this into your context menu with a simple batch file and registry edit.  My batch file looks like this:


The first line "@echo off" turns off all of the text output except for the actual output of the program.  The "Title" command gives the window a title.  The next command is the FCIV that this article is about.  Adding -both outputs both MD5 and SHA1.  %1 is the variable for the file name.  I then added | clip which sends the output to the clipboard.  You can easily remove that line if you prefer not to do that, but I find it quite handy.  The last two lines are really the only necessary lines, which do the same as before but output it to the screen the pauses so the window doesn't close.  The end result looks like this:


To get this into the context menu I followed a guide over at: http://www.edwardawebb.com/tips/verify-file-checksum-windows-context-menu

I made a file in notepad called hash.reg and put the following into it:


That's all there is to it. With just a few easy lines you end up with the ability to compute hashes with a right click and copy it to the clipboard.  I hope this has been helpful to you, let me know below in the comments!

-Sean

No comments:

Post a Comment