The Digest::MD5 module allows simpler creation of MD5 hashes. MD5 takes as input a message of arbitrary length and creates a 128-bit fingerprint, or digest, of the input. Like the Digest module, Digest::MD5 implements both a functional and object-oriented interface, which offer the same benefits. Digest::MD5 also outputs binary (16 bytes long), hexadecimal (32 characters long), and base64 (22 characters long) data.
To rewrite the example in Section 8.57:
#!/usr/local/bin/perl -w # Yes, functional interface use Digest::MD5 qw(md5_hex); my $text = `Be the ball, Danny!'; my $hexed = md5_hex($text); print "The sum of $text is [$hexed]. ";
You can use the object-oriented interface like so:
#!/usr/local/bin/perl -w use Digest::MD5; my $text = `Be the ball, Danny!'; my $md5 = Digest::MD5->new(); $md5->add($text); my $sum = $md5->hexdigest; print "The sum of $text is [$sum]. ";
Digest::MD5 implements (and exports) the following functions.
18.118.139.224