[ Brent Chapman writes: ]
> So, anybody got a version of MD5 or SNEFRU implemented in Perl? :-)
See the MD5 extension on any Perl CPAN site.
MD5 - Perl interface to the RSA Data Security Inc. MD5
$context = new MD5;
$digest = $context->digest();
$string = $context->hexdigest();
The MD5 module allows you to use the RSA Data Security Inc.
MD5 Message Digest algorithm from within Perl programs.
A new MD5 context object is created with the new operation.
Multiple simultaneous digest contexts can be maintained, if
desired. The context is updated with the add operation
which adds the strings contained in the LIST parameter. The
context is updated after each element is added so that
add('foo', 'bar') may give different results to
The final message digest value is returned by the digest
operation as a 16-byte binary string. This operation
delivers the result of operations since the last new or
reset operation. Once the operation has been performed, the
context must be reset before being used to calculate another
Two convenience functions are also provided. The addfile
operation takes an open file-handle and reads it until end-
of file in 1024 byte blocks adding the contents to the
context. The hexdigest operation calls digest and returns
the result as a printable string of hexdecimal digits. This
is exactly the same operation as performed by the unpack
operation in the following example.
$md5 = new MD5;
$digest = $md5->digest();
print("Digest is " . unpack("H*", $digest) . "\n");
The above exmaple would print out the message
Digest is 6df23dc03f9b54cc38a0fc1483df6e21
provided that the implementation is working correctly.
The MD5 extension may be redistributed under the same terms
as Perl. The MD5 algorithm is defined in RFC1321. The basic
C code implementing the algorithm is derived from that in
the RFC and is covered by the following copyright:
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991.
All rights reserved.
License to copy and use this software is granted provided
that it is identified as the "RSA Data Security, Inc. MD5
Message-Digest Algorithm" in all material mentioning or
referencing this software or this function.
License is also granted to make and use derivative works
provided that such works are identified as "derived from the
RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all
material mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning
either the merchantability of this software or the
suitability of this software for any particular purpose. It
is provided "as is" without express or implied warranty of
These notices must be retained in any copies of any part of
this documentation and/or software.
This copyright does not prohibit distribution of any version
of Perl containing this extension under the terms of the GNU
or Artistic licences.
The MD5 interface was written by Neil Winton
Dave Wolfe *Not a spokesman for Motorola*
Motorola MMTG 6501 Wm. Cannon Dr. W. OE112 Austin TX 78735-8598