In cryptography, the hash of a message or a file is calculated using one way algorithm ms like MD5, SHA256, BLAKE3 etc. The hash is number calculated using these algorithms and it stays unique for the message. A change in the hash value indicates that the original message has also changed. Even a single letter changed in the original message will cause the hash to completely change.
Checking file integrity with hashes
We can use hash value for a file to see if the file has been modified. For example, if you download Mozilla Firefox installer package from https://ftp.mozilla.org/pub/firefox/releases/ and the calculated hash does not match the provided hash, then the file could have become corrupted in some way. We can do the same with downloaded Windows 11 ISO images.
Finding hashes using PowerShell
There are two easy ways to calculate file hashes on a Windows 11 PC. Both of these methods use Terminal. The first method uses the pre-installed Windows PowerShell which is now integrated with the Terminal. You have to start by right-clicking on the desktop and choosing to launch Terminal there. In the Terminal you have to give a command: Get-FileHash followed by full path name of the file. It calculates SHA256 hash for the given file by default but we can also specify an algorithm such as SHA512, MD5 etc.
Finding hashes using DirHash
While Get-FileHash does the job, it supports only a limited number of hashing algorithms namely SHA1, SHA256, SHA384, SHA512, and MD5 . Instead, you can use an open-source and very fast tool called DirHash. It is written using C language and offers many more algorithms such as SHA1, SHA256, SHA384, SHA512, MD5, Blake2s, Blake2b, Blake3, Streebog. The command line of DirHash is almost the same as that of Get-FileHash.
So these are two very fast methods of calculating file hashes on Windows 11. In my personal opinion, DirHash is superior in performance (at least on my Intel Core i5 PC) of the two tools.