What they are
Hash are used in computer science to map a string (a sequence of bits) of arbitrary length into a string of predefined length.
It is a sort of ‘signature’ of an electronic document. For each string you can calculate a hash, so each different string will have different hashes.
However, calculating the hash of the same file (string) twice will result in the same output.
Hash calculated with different algorithms will obviously give different result.
They are used to verify the integrity of files (used for this also in computer forensics).
For example, when you download a Windows ISO, under the download link you will find the corresponding SHA1 key.
Well, once downloaded on your PC, to verify that the file is intact (free of transmission errors or voluntary tampering due to MITM attacks) you just need to recalculate the hash locally and compare it with the string provided online.
Learn more about hashes here.
You can use CertUtil:
CertUtil -hashfile c:\path\filename.ext <algorithm>
instead of <algorithm> enter one of these: MD2, MD4, MD5, SHA1, SHA256, SHA384, SHA512.
Alternatively you can use the File Checksum Integrity Verifier (FCIV) utility to calculate the MD5 or SHA-1 cryptographic hash values of a file.
FCIV -md5 -sha1 c:\path\filename.ext
It is not possible to generate CRC32, however, for Windows there is also a very useful free program from Nirsoft,
HashMyFiles, downloadable from the relevant site, which allows the calculation from GUI also with this algorithm.
$ echo abcdefg.. | md5sum
$ echo abcdefg.. | sha1sum
For the CRC32 calculation of a file:
$ cksum /path/filename.ext
For MD5 or SHA calculation of a file:
$ md5sum /path/filename.ext
$ sha1sum /path/filename.ext
$ sha256 /path/filename.ext
$ sha512 /path/filename.ext
$ sha256sum -c /path/filename-CHECKSUM
In this case, if the calculation coincides, an OK will be given.
md5 /path/filename.ext shasum -a 1 /path/filename.ext shasum -a 256 /path/filename.ext crc32 /path/filename.ext
It is also possible to use online tools.
One of these is definitely OnlineMD5.com, which will allow us to calculate MD5 and SHA hashes for both files and text strings directly from the browser and without physically loading the file.