This message digest program works like a checksum program. It takes a file and produces a 20 byte fingerprint of that file. The RIPEMD-160 algorithm that it uses is constructed in such a way that the chances of two different files having the same fingerprint is extremely small. You can use this program to compare files and to verify that files haven't been altered.
Download rmd160.tar.gz. Documentation is included.
First, let's obtain the message digests for a few files in a directory.
[56/553] Sun Jan 12 00:10:01 (narf:cheah):~/rmddemo $ ls -l total 5 -rw-r--r-- 1 cheah users 1324 Jan 12 00:08 x.txt -rw-r--r-- 1 cheah users 612 Jan 12 00:08 y.txt -rw-r--r-- 1 cheah users 1818 Jan 12 00:08 z.bin [57/554] Sun Jan 12 00:10:03 (narf:cheah):~/rmddemo $ rmd160 * 70af994490a3f70689bbb6913129dc90600977ef x.txt 6bee5d8f2d2db27ee77fa4084ea871076eb59527 y.txt 8805de25fdd107f011882a188a09f275916d6396 z.bin [58/555] Sun Jan 12 00:10:06 (narf:cheah):~/rmddemo $
rmd160 can also be used to check files against the
message digest output saved from a previous run.
[58/555] Sun Jan 12 00:10:06 (narf:cheah):~/rmddemo $ rmd160 * >digests [59/556] Sun Jan 12 00:11:41 (narf:cheah):~/rmddemo $ rmd160 -c -v digests GOOD x.txt GOOD y.txt GOOD z.bin [60/557] Sun Jan 12 00:11:50 (narf:cheah):~/rmddemo $
Now let's append a line to one of the files and see if
rmd160 detects the change.
[61/558] Sun Jan 12 00:13:09 (narf:cheah):~/rmddemo *$ echo hello >> x.txt [62/559] Sun Jan 12 00:13:14 (narf:cheah):~/rmddemo $ rmd160 -c -v digests FAILED x.txt GOOD y.txt GOOD z.bin rmd160: 1 of 3 file(s) failed RIPEMD-160 check [63/560] Sun Jan 12 00:13:16 (narf:cheah):~/rmddemo $
There is an article on RIPEMD-160 with source code for the algorithm in the January 1997 issue of Dr. Dobb's Journal.
The command line interface and output format for
rmd160 is based on
md5sum from the GNU textutils collection.