July 09, 2010

Getting the checksum of a file on a Mac

This is just another post for my future reference. Perhaps someone else will find this useful as well.

Verifying the checksum of a download is a way to check that the integrity of the file has not been violated. If the checksum of the download matches the specified value from the source, you can be pretty sure the file is as it should be (not modified or tampered with).

I've been wanting to verify the checksum of downloaded files before, but never taken the time to find out how, or bother to download third-party software to do it for me.

Here are a few alternatives:

  1. In Terminal.app you can find different checksums (source, thank you)
    1. To find the md5 checksum for a file, type: $ md5 [pathToFile]
    2. Another way to find the md5 checksum for a file, type: $ openssl md5 [pathToFile]
    3. To find the sha1 checksum for a file, type:$ openssl sha1 [pathToFile]
  2. You can create an Automator folder action to do the work for you (md5). Luckily Moebius Strip Software has already done that.
  3. If you don't care to open Terminal.app, there is a third-party cocoa wrapper for openssl here that will allow you to simply drop the file into the window and the calculation of checksums (md5 and sha1) starts automatically.

No comments: