Update for ext/Digest/MD5/
[p5sagit/p5-mst-13.2.git] / ext / Digest / MD5 / MD5.pm
index 18dc1f6..08e616e 100644 (file)
@@ -3,7 +3,7 @@ package Digest::MD5;
 use strict;
 use vars qw($VERSION @ISA @EXPORT_OK);
 
-$VERSION = '2.19';  # $Date: 2002/05/02 02:40:12 $
+$VERSION = '2.21';  # $Date: 2002/12/28 05:30:03 $
 
 require Exporter;
 *import = \&Exporter::import;
@@ -214,6 +214,29 @@ the file:
 
     print Digest::MD5->new->addfile(*FILE)->hexdigest, " $file\n";
 
+Perl 5.8 support Unicode characters in strings.  Since the MD5
+algorithm is only defined for strings of bytes, it can not be used on
+strings that contains chars with ordinal number above 255.  The MD5
+functions and methods will croak if you try to feed them such input
+data:
+
+    use Digest::MD5 qw(md5_hex);
+
+    my $str = "abc\x{300}";
+    print md5_hex($str), "\n";  # croaks
+    # Wide character in subroutine entry
+
+What you can do is calculate the MD5 checksum of the UTF-8
+representation of such strings.  This is achieved by filtering the
+string through encode_utf8() function:
+
+    use Digest::MD5 qw(md5_hex);
+    use Encode qw(encode_utf8);
+
+    my $str = "abc\x{300}";
+    print md5_hex(encode_utf8($str)), "\n";
+    # 8c2d46911f3f5a326455f0ed7a8ed3b3
+
 =head1 SEE ALSO
 
 L<Digest>,