Wednesday, May 02, 2012

MD5 sums

Mac OS X has a really awful MD5 tool. On Linux we have the md5sum tool which outputs the following when you run it against a file

#md5sum file
8c45b25f15362fb3a74959bb7056df5f *file

On Mac we have a wrapper for openssl md5 which provides the bellow output
#md5 file
MD5 (file) = 8c45b25f15362fb3a74959bb7056df5f

On Linux I can then sort the output numerically and then very easily see what files are duplicates. I can also use the wonderful -c option to take in a file containing MD5s and file-names in the same style as the output of md5sum so that I can -c Check that the files are the same.

On Mac OS X neither of these simple and effective uses can be completed without bending over backwards with manual work or coming up with some script to do the same thing. I tried to install md5sum from ports, however, it doesn't exist there. So for now I am stuck with an inferior tool which does not accomplish my goals of using the MD5 hash to both remove duplicate files and confirm that moved files haven't been corrupted.

This Rant is brought to you by Craig

2 comments:

Andrew Ong said...

md5 -r will output the same as md5sum, this will help but I agree the md5sum -c packing.slip or manifest file is a good tool

Craig Lorentzen said...

Hi Andrew,

Thanks for the comment...I had found that out but forgot to come back and add it for the rest of the world. Glad someone else was able to post it in case anyone else comes here as well.

-Craig