How to Check SHA1 Sum on OS X

If you ever wonder how to check SHA1 sum on OS X, here is how. Open up a Terminal window. Change the directory to the file location. Issue the following command.

openssl sha1 filename

The openssl can also check the following digests: md2, md5, mdc2, rmd160 and sha. This is useful when you download some files not from the original sites and you want to check the integrity of the files.

I was trying to download the Pwange tool using bit torrent client. After the download was complete, I was surprised to find that the file has been tampered because the checksum is different. I heard that there are increasing interests in the hacker communities about iPhone and Mac OS X. Maybe this is a sign. You might want to check your downloads from now on.

  • Wes

    Thanks for the tip. It’s simple but non-obvious.

  • Peter

    You sir, are a [email protected] [email protected]!
    Thank you!

  • ‘Cisco

    Didn’t work for me, running OS X 10.7.3 … However, I was able to get it to work from memory using the “<" sign as follows:

    openssl sha1 < filename.dmg

    works the same way for md5:

    openssl md5 < filename.dmg

    The "<" symbol in *nix tells the command (in this case openssl using sha1 or md5), to use "filename.dmg" as the file to compare.

  • Jason

    I just use `shasum filename` it gives me the same sum and is a little less typing