Digest::Perl::MD4 - Perl implementation of Ron Rivests MD4 Algorithm


Digest-Perl-MD4 documentation  | view source Contained in the Digest-Perl-MD4 distribution.

Index


NAME

Top

Digest::Perl::MD4 - Perl implementation of Ron Rivests MD4 Algorithm

DISCLAIMER

Top

This is not C-code interface (like Digest::MD5) but a Perl-only implementation of MD4 (like Digest::Perl::MD5). Because of this, it is slow but avoids platform specific complications. For efficiency you should use Digest::MD4 instead of this module if it is available.

SYNOPSIS

Top

 # Functional style
 use Digest::Perl::MD4 qw(md4 md4_hex md4_base64);

 $hash = md4 $data;
 $hash = md4_hex $data;
 $hash = md4_base64 $data;




 # OO style
 use Digest::Perl::MD4;

 $ctx = Digest::Perl::MD4->new;

 $ctx->add($data);
 $ctx->addfile(*FILE);

 $digest = $ctx->digest;
 $digest = $ctx->hexdigest;
 $digest = $ctx->b64digest;

DESCRIPTION

Top

This modules has the same interface as Digest::MD5. It should be compatible with the Digest::MD4 module written by Mike McCauley <mikem@open.com.au>.

EXAMPLES

Top

The simplest way to use this library is to import the md4_hex() function (or one of its cousins):

    use Digest::Perl::MD4 'md4_hex';
    print 'Digest is ', md4_hex('foobarbaz'), "\n";

The above example would print out the message

    Digest is b2b2b528f632f554ae9cb2c02c904eeb

provided that the implementation is working correctly. The same checksum can also be calculated in OO style:

    use Digest::Perl::MD4;

    $md4 = Digest::Perl::MD4->new;
    $md4->add('foo', 'bar');
    $md4->add('baz');
    $digest = $md4->hexdigest;

    print "Digest is $digest\n";

LIMITATIONS

Top

This implementation of the MD4 algorithm has some limitations:

It is slow, very slow, but still useful for encrypting small amounts of data like passwords.

You can only encrypt up to 2^32 bits = 512 MB on 32bit archs.

Digest::Perl::MD4 loads all data to encrypt into memory. This is a todo.

SEE ALSO

Top

Digest::MD5

RFC 1320

COPYRIGHT

Top

AUTHORS

Top

The original MD5 interface was written by Neil Winton <N.Winton@axion.bt.co.uk>.

Digest::MD5 was made by Gisle Aas <gisle@aas.no>.

Digest::Perl::MD5 was made by Christian Lackas <delta@clackas.de>.

MD5 in 8 lines of perl5 implemented and optimized for size by John Allen[3] and collected by Adam Back[5] <adam@cypherspace.org>. Conversion to MD4 algorithm by Ted Anderson <tedanderson@mindspring.com>.

Footnotes

Top

[3]

allen@grumman.com

[5]

http://www.cypherspace.org/~adam/


Digest-Perl-MD4 documentation  | view source Contained in the Digest-Perl-MD4 distribution.