Page 1 of 1

hashdeep/md5deep (CLI hashing utilities)

Posted: Sun Jun 24, 2018 1:15 pm
by Midas
If you do any research into hashing tools you're bound to come across multi-platform md5deep/hashdeep (, regarded as more or less the standard solution for anything related.
md5deep is a set of programs to compute MD5, SHA-1, SHA-256, Tiger, or Whirlpool message digests on an arbitrary number of files. md5deep is similar to the md5sum program found in the GNU Coreutils package, but has [...] additional features...

md5deep is FLOSS (source is on Github) with a somewhat peculiar license blurb:
At the time md5deep was originally written, Mr. Kornblum was a Special Agent with the United States Air Force Office of Special Investigations (AFOSI). As such, the program is considered to be a work of the United States Government. Under 17 USC 105, works of the United States Government are not eligible for copyright protection.

md5deep is composed of a set of 12 different command line executables, each one geared towards a different hashing method and OS bitness. Documentation is rather extensive.

Download md5deep/hashdeep v4.4, released 2014-01-29, from

As a contribution for the problem I brought to a recent discussion, here's a quick'n'dirty™ script to use md5deep to hash and sidecar any file dropped on it: :wink:

Code: Select all


:: Conditional clause below is a crude detector of OS bitness
:: Allowing for running the corresponding executable
:: Made by Midas, 2018-06-24
MD5Deep%BOS% -bk "%1" > "%~n1.md5"

Re: CLI hashing script

Posted: Tue Oct 09, 2018 7:07 am
by Midas
Improving on my own previous solution, here's a hybrid batch script that works in Windows 7 and doesn't require any external utility, only an existing Powershell v4 or newer -- apparently that 'get-filehash' command doesn't work in previous versions. I was lead to this solution from the simple validating instructions in RegistryFinder homepage.

If you create a plain text file named 'shash.cmd' with the following code and drop any other file from the same folder on it, it will create the corresponding hash in a file with the 'md5' extension (alternatively, you can use 'shash filename.ext' at the CLI). I often use such files to validate downloads using Teracopy's shell extension, if an hash is available online (e.g., as in the case of

Code: Select all

REM Sidecar MD5 hashing script v0.1 by Midas ( 2018-10-08)
POWERSHELL "get-filehash %1 -Algorithm md5 | ForEach-Object { $_.Hash }" > _tmp_
SET /P _hash=<_tmp_
DEL _tmp_
ECHO %_hash% *%~nx1> "%~n1.md5"
Please note that this will also work for SHA1, SHA256, SHA384, and SHA512 if all instances of "md5" in the code above are replaced with the appropriate algorithm string.

PS: I know there are more elegant ways to pass the result of the first command directly to a variable, but I found none simpler than using a temporary file. Suggestions welcome.