Check SHA1 and MD5 Hash on your Mac
SHA hashing is frequently used with distribution control systems to determine revisions and to check data integrity by detecting file corruption or tampering. For common usage, a SHA checksum provides a string that can be used to verify a file has been transferred as intended. If SHA checksums match, the integrity of the files has been maintained.
Using SHA1 hash strings is also an easy way to verify file transfers from peer-to-peer networks and to make sure a download has finished, or that a file was not tampered with somewhere along the line. By knowing the origin SHA1 checksum, you can verify your version of the file(s) in question matches, and determine if the file is indeed valid and has arrived as intended.
On Windows machines, you can use simple and light tools like HashMyFiles to check MD5 and SHA Hash and compare it with the original SHA and MD5 which are provided by an authorized source to make sure you have the right version of the file and not tampered.
On Mac, we can use an integrated tool which is simple and easy. To do so you just need to open the terminal on your Mac and use the following commands:
md5 <file path and name>
shasum <file path and name>
for instance, here I try to find out the newly downloaded Debian 9.0.0 iso image and just compared it with the provided MD5 and SHA1 hash from the Debian website.
MD5:
and compare with the original MD5:
SHA1:

and compare with the original SHA:



