MD5 Checksums and related matters

MD5 is the commnuly used Message Digest format for checking the integrity of files. It works like a checksum but is more sensitive to changes in the file.

This is described, with C code, in RFC1321 (UK Text copy). Linux systems have the command md5sum to which you pass a filename. You can see lots of references to this by googling for [md5 cert] and the JANET (Joint Academic NETwork of the UK) have the code for download at: http://www.ja.net/CERT/Software/md5/

You can get a zip file from http://www.fedcirc.gov/tools/md5.zip but I don't know if that is a binary or source package.

There is another tar file listed here: http://www.cert.mil/resources/security_tools.htm.

It can be done in Perl: http://search.cpan.org/author/GAAS/Digest-MD5-2.23/MD5.pm which has examples of how to do this for files as well as strings.

It can be done in Ruby (according to http://www.dm4lab.to/~usa/ruby/index_en.html#download ) with:
ruby -r md5 -e "puts MD5.new(File.open('filename', 'rb').read).hexdigest"

There's a C++ version linked off and described here: http://www.codeguru.com/algorithms/md5.shtml but it may be windows specific. I could send you the tarball, but you have no reason to trust me, and as the whole point of md5 is for security....

Secure Hash Function (SHA-1, SHA-256, SHA-384, SHA-512)

An alternative to MD5 is the Secure Hash Standard (PDF). This is more secure than MD5 but SHA-1 has still been compromised. One can compute SHA-512 hashes with Ruby using:
ruby -r digest/sha2 -e "puts Digest::SHA512.new(File.open('$1', 'rb').read).hexdigest"


Modification times

Created: 14-FEB-2003 by Hugh Sasse

Last Modified: 06-APR-2005 by Hugh Sasse

$Revision: 1.2 $