[lug] portable md5 function?
rotering at animalcules.com
rotering at animalcules.com
Tue Aug 21 12:08:07 MDT 2001
On Tue, Aug 21, 2001 at 11:28:13AM -0600, D. Stimits wrote:
> I'm trying to find out if there is now a semi-portable (at least among
> linux machines, probably UNIX in general) md5 sum function call
> available.
OpenSSL (as of 0.9.6a) contains functions to compute several different
message digests, including md5.
The driver for /dev/random (/usr/src/linux/drivers/char/random.c) also
contains a commonly-available implementation of MD5.
Depending on your personal boredom quotient, implementing MD5 from RFC
1321 without peeking at existing implementations is fun. I did this
for a napster client I was working on (before Napster went effectively
Tango Utah) and learned a lot about bitwise operators and how to write
bad preprocessor macros (I stopped when I produced valid checksums for
files >= 516 bytes assuming I'd never see an mp3 file smaller than
that). It's only about 225 lines and it's not rocket science, so
rolling your own is an option if you're not willing to use the PD
implementations out there.
More information about the LUG
mailing list