OpenSSL does it. There'll also be a CPAN module.
I do SHA1 instead of MD5 using the above 2 tools - falling back to the
Perl module where OpenSSL fails a test case (for instance if it's not
installed).
--
Elvis Notargiacomo master AT barefaced DOT cheek
http://www.notatla.org.uk/goen/
md5sum is part of GNU textutils.
Sun has md5 at http://sunsolve.sun.com/md5/ :-)
-Peter
Which, for whatever reason, doesn't use Sun's own optimized MD5 library
(see `man md5`). That's why I used the md5 source distribution from
ftp://ftp.cerias.purdue.edu/pub/tools/unix/crypto/md5/ and modified
it to use Sun's libmd5 instead (one only needs to swap "md5.h" and
md5c.c against <md5.h> and -lmd5). `ldd md5` then shows:
libmd5.so.1 => /usr/lib/libmd5.so.1
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Sun-Fire-880/lib/libmd5_psr.so.1
/usr/platform/SUNW,Sun-Fire-880/lib/libc_psr.so.1
The times to compute md5 of a 100 MB file:
http://sunsolve.sun.com/md5/: 4.220 sec
md5 from ftp://ftp.cerias.purdue.edu/: 2.780 sec
modified md5 using -lmd5: 2.080 sec
The speed-up is neglibible when using md5 to check for correct downloads,
but for certain intrusion detection tools which check lots of file
checksums it can be quite helpful.
mp.
--
Systems Administrator | Institute for Software Science | Univ. of Vienna
>Which, for whatever reason, doesn't use Sun's own optimized MD5 library
>(see `man md5`). That's why I used the md5 source distribution from
>ftp://ftp.cerias.purdue.edu/pub/tools/unix/crypto/md5/ and modified
>it to use Sun's libmd5 instead (one only needs to swap "md5.h" and
>md5c.c against <md5.h> and -lmd5). `ldd md5` then shows:
That's because it predates Sun's own MD5 library.
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
I guess the perfect solution would be having a Sun-provided /usr/bin/md5,
coming with the OS, which is linked against libmd5 only if this is
actually available within the OS, too (and statically linked, if it
isn't).
>Casper H.S. Dik <Caspe...@sun.com> wrote:
>> Martin Paul <m...@par.univie.ac.at> writes:
>>
>>>Which, for whatever reason, doesn't use Sun's own optimized MD5 library
>>>(see `man md5`).
>>
>> That's because it predates Sun's own MD5 library.
>I guess the perfect solution would be having a Sun-provided /usr/bin/md5,
>coming with the OS, which is linked against libmd5 only if this is
>actually available within the OS, too (and statically linked, if it
>isn't).
Solaris 10 has it's own built-in md5 command (digest -a md5).
Solaris 10 doesn't have static linking (and those of you who still
think that static linking buys you anything; compare the number of
"bad C libraries" for Solaris with the number of "bad kernel modules"[1];
static linking helps against bad libraries but has no chance of helping
against bad kernel modules.
Casper
[1] I haven't seen a rootkit libc since my SunOS 4.x days; I have seen
somewhere between 5-10 loadable kernel modules from rootkits for Solaris.