DirHash : Command Line Tool for Calculating Hashes

A file or a folder hash is a unique hexadecimal number calculated based on the source data. If the source data is modified, the hash calculated using that data also changes. This is why file hashes can be used verify the integrity of files – of the original file hash does not match, then file has been altered in some way or other.

There are many hashing algorithms that use different approach for finding the hash such as MD5, SHA-1, SHA-256, RIPEMD-160 and more. Similarly, there are many tools for calculating file or folder hashes. If you are looking for a command line tool for calculating hashes, then you can try DirHash.

DirHash is an open-source tool for finding the hashes of folders but it can also be used to calculate hashes of individual files. When finding the hashes of folders, it uses all the contents of that folder found recursively. For the very basic use, the command is DirHash [folder name]. For example, if you want to find the hash of C:\Windows\ then you can give the command DirHash.exe C:\Windows.


There are many parameters available which can be used for many reasons. For example, we can use -nowait to prevent it from waiting after the output. We can also specify the hashing algorithm after the folder name such as MD5, SHA1, SHA256, SHA384, SHA512 and, Streebog. The fastest of all of these algorithm is MD5. It uses OpenSSL code for finding the hashes, but we can also use the parameter -mscrypto to force it in using the Microsoft Windows API for hashing algorithms.


DirHash also comes with benchmark tools. We can use it to find how fast your system can calculate hashes of given data. For this, we can give the command DirHash.exe -benchmark MD5 which will benchmark your system and find the hashing rate using the MD5 algorithm. Instead of MD5, we can also use other supported algorithms such as SHA512 too.


DirHash is a very useful tool and can be used in batch scripts. It can output the file hash output to a text file which can be used as a checksum file for verifying against at a later time.

You can download DirHash from https://idrassi.github.io/DirHash/.