[Orca-checkins] rev 173 - in trunk/orca: . packages packages/Digest-MD5-2.21 packages/Digest-MD5-2.21/t packages/Digest-MD5-2.21/hints

blair at orcaware.com blair at orcaware.com
Sun Dec 29 13:27:02 PST 2002


Author: blair
Date: 2002-12-29 13:26:06 -0800 (Sun, 29 Dec 2002)
New Revision: 173

Added:
   trunk/orca/packages/Digest-MD5-2.21/
   trunk/orca/packages/Digest-MD5-2.21/hints/MacOS.pl
   trunk/orca/packages/Digest-MD5-2.21/t/align.t
Removed:
   trunk/orca/packages/Digest-MD5-2.20/
Modified:
   trunk/orca/INSTALL
   trunk/orca/configure
   trunk/orca/configure.in
   trunk/orca/packages/Digest-MD5-2.21/Changes
   trunk/orca/packages/Digest-MD5-2.21/MANIFEST
   trunk/orca/packages/Digest-MD5-2.21/MD5.pm
   trunk/orca/packages/Digest-MD5-2.21/Makefile.PL
   trunk/orca/packages/Digest-MD5-2.21/t/files.t
Log:
Upgrade Digest::MD5 from 2.20 to 2.21 and require the new version for
Orca.

* INSTALL:
  Update all references to Digest::MD5's version number from 2.20 to
  2.21.

* configure.in:
  Bump Digest::MD5's version number to 2.21.

* configure:
  Bump Digest::MD5's version number to 2.21.

* packages/Digest-MD5-2.21:
  Renamed from packages/Digest-MD5-2.20.  Directory contents updated
  from Digest-MD5-2.21.tar.gz.


Modified: trunk/orca/configure
==============================================================================
--- trunk/orca/configure	(original)
+++ trunk/orca/configure	2002-12-29 13:26:19.000000000 -0800
@@ -1083,8 +1083,8 @@
 DATA_DUMPER_VER=2.101
 DATE_PARSE_DIR=TimeDate-1.14
 DATE_PARSE_VER=2.24
-DIGEST_MD5_DIR=Digest-MD5-2.20
-DIGEST_MD5_VER=2.19
+DIGEST_MD5_DIR=Digest-MD5-2.21
+DIGEST_MD5_VER=2.21
 MATH_INTERPOLATE_DIR=Math-Interpolate-1.05
 MATH_INTERPOLATE_VER=1.05
 RRDTOOL_DIR=rrdtool-1.0.40

Modified: trunk/orca/configure.in
==============================================================================
--- trunk/orca/configure.in	(original)
+++ trunk/orca/configure.in	2002-12-29 13:26:19.000000000 -0800
@@ -31,8 +31,8 @@
 DATA_DUMPER_VER=2.101
 DATE_PARSE_DIR=TimeDate-1.14
 DATE_PARSE_VER=2.24
-DIGEST_MD5_DIR=Digest-MD5-2.20
-DIGEST_MD5_VER=2.19
+DIGEST_MD5_DIR=Digest-MD5-2.21
+DIGEST_MD5_VER=2.21
 MATH_INTERPOLATE_DIR=Math-Interpolate-1.05
 MATH_INTERPOLATE_VER=1.05
 RRDTOOL_DIR=rrdtool-1.0.40

Modified: trunk/orca/INSTALL
==============================================================================
--- trunk/orca/INSTALL	(original)
+++ trunk/orca/INSTALL	2002-12-29 13:26:19.000000000 -0800
@@ -142,7 +142,7 @@
     Name			Required Version	Included With Orca
     ----------------------------------------------------------------------
     Data::Dumper		2.101 or greater	2.101
-    Digest::MD5			2.20 or greater		2.20
+    Digest::MD5			2.21 or greater		2.21
     Math::IntervalSearch	1.05 or greater		1.05
     RRDs			1.0.33 or greater	1.0.33
     Storable			2.06 or greater		2.06
@@ -173,10 +173,10 @@
 
     Digest::MD5
 
-      http://www.perl.com/CPAN/authors/id/G/GA/GAAS/Digest-MD5-2.20.tar.gz
+      http://www.perl.com/CPAN/authors/id/G/GA/GAAS/Digest-MD5-2.21.tar.gz
 
-      % gunzip -c Digest-MD5-2.20.tar.gz | tar xvf -
-      % cd Digest-MD5-2.20
+      % gunzip -c Digest-MD5-2.21.tar.gz | tar xvf -
+      % cd Digest-MD5-2.21
       % perl Makefile.PL
       % make
       % make test

Copied: Digest-MD5-2.21 (from rev 172, trunk/orca/packages/Digest-MD5-2.20)

Modified: trunk/orca/packages/Digest-MD5-2.21/MD5.pm
==============================================================================
--- trunk/orca/packages/Digest-MD5-2.20/MD5.pm	(original)
+++ trunk/orca/packages/Digest-MD5-2.21/MD5.pm	2002-12-29 13:26:20.000000000 -0800
@@ -3,7 +3,7 @@
 use strict;
 use vars qw($VERSION @ISA @EXPORT_OK);
 
-$VERSION = '2.20';  # $Date: 2002/05/06 05:15:09 $
+$VERSION = '2.21';  # $Date: 2002/12/28 05:30:03 $
 
 require Exporter;
 *import = \&Exporter::import;
@@ -214,6 +214,29 @@
 
     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>,

Modified: trunk/orca/packages/Digest-MD5-2.21/t/files.t
==============================================================================
--- trunk/orca/packages/Digest-MD5-2.20/t/files.t	(original)
+++ trunk/orca/packages/Digest-MD5-2.21/t/files.t	2002-12-29 13:26:20.000000000 -0800
@@ -10,30 +10,36 @@
 use strict;
 use Digest::MD5 qw(md5 md5_hex md5_base64);
 
-#
-# This is the output of: 'md5sum Changes README MD5.pm MD5.xs rfc1321.txt'
-#
-my $EXPECT;
-
 # To update the EBCDIC section even on a Latin 1 platform,
 # run this script with $ENV{EBCDIC_MD5SUM} set to a true value.
 # (You'll need to have Perl 5.7.3 or later, to have the Encode installed.)
 # (And remember that under the Perl core distribution you should
 #  also have the $ENV{PERL_CORE} set to a true value.)
+# Similarly, to update MacOS section, run with $ENV{MAC_MD5SUM} set.
 
+my $EXPECT;
 if (ord "A" == 193) { # EBCDIC
     $EXPECT = <<EOT;
-b362148b17a451f0d81e0ebb2487756e Changes
-5a591a47e8c40fe4b78c744111511c45 README
-3157e2d2e27dacddea7c54efddc32520 MD5.pm
-4850753428db9422e8e5f97b401d5a13 MD5.xs
-276da0aa4e9a08b7fe09430c9c5690aa rfc1321.txt
+36158997c99f2e1396ee40ddc4634a40  Changes
+5a591a47e8c40fe4b78c744111511c45  README
+770a5ef28ab15e66355639f21152afb0  MD5.pm
+4850753428db9422e8e5f97b401d5a13  MD5.xs
+276da0aa4e9a08b7fe09430c9c5690aa  rfc1321.txt
+EOT
+} elsif ("\n" eq "\015") { # MacOS
+    $EXPECT = <<EOT;
+e68b13fe9edf36fe13551bf410b7a745  Changes
+3519f3d02c7c91158f732f0f00064657  README
+4113db8afad83eb7c01f1bf2c53e66ee  MD5.pm
+1be293491bba726810f8e87671ee0328  MD5.xs
+754b9db19f79dbc4992f7166eb0f37ce  rfc1321.txt
 EOT
 } else {
+    # This is the output of: 'md5sum Changes README MD5.pm MD5.xs rfc1321.txt'
     $EXPECT = <<EOT;
-0106b67df0dbf9f4d65e9fc04907745b  Changes
+e68b13fe9edf36fe13551bf410b7a745  Changes
 3519f3d02c7c91158f732f0f00064657  README
-88c35ca46c7e8069fb5ae00c091c98d6  MD5.pm
+4113db8afad83eb7c01f1bf2c53e66ee  MD5.pm
 1be293491bba726810f8e87671ee0328  MD5.xs
 754b9db19f79dbc4992f7166eb0f37ce  rfc1321.txt
 EOT
@@ -77,7 +83,12 @@
          require Encode;
 	 my $data = cat_file($file);	
 	 Encode::from_to($data, 'latin1', 'cp1047');
-	 print md5_hex($data), " $base\n";
+	 print md5_hex($data), "  $base\n";
+	 next;
+     }
+     if ($ENV{MAC_MD5SUM}) {
+	 my $data = cat_file($file);	
+	 print md5_hex($data), "  $base\n";
 	 next;
      }
      my $md5bin = pack("H*", $md5hex);
@@ -172,6 +183,10 @@
     my($file) = @_;
     local $/;  # slurp
     open(FILE, $file) or die "Can't open $file: $!";
+
+    # For PerlIO in case of UTF-8 locales.
+    eval 'binmode(FILE, ":bytes")' if $] >= 5.008;
+
     my $tmp = <FILE>;
     close(FILE);
     $tmp;

Added: trunk/orca/packages/Digest-MD5-2.21/t/align.t
==============================================================================
--- trunk/orca/packages/Digest-MD5-2.20/t/align.t	(original)
+++ trunk/orca/packages/Digest-MD5-2.21/t/align.t	2002-12-29 13:26:20.000000000 -0800
@@ -0,0 +1,22 @@
+BEGIN {
+	if ($ENV{PERL_CORE}) {
+	        chdir 't' if -d 't';
+	        @INC = '../lib';
+	}
+}
+
+# Test that md5 works on unaligned memory blocks
+
+print "1..1\n";
+
+use strict;
+use Digest::MD5 qw(md5_hex);
+
+my $str = "\100" x 20;
+substr($str, 0, 1, "");  # chopping off first char makes the string unaligned
+
+#use Devel::Peek; Dump($str); 
+
+print "not " unless md5_hex($str) eq "c7ebb510e59ee96f404f288d14cc656a";
+print "ok 1\n";
+

Added: trunk/orca/packages/Digest-MD5-2.21/hints/MacOS.pl
==============================================================================
--- trunk/orca/packages/Digest-MD5-2.20/hints/MacOS.pl	(original)
+++ trunk/orca/packages/Digest-MD5-2.21/hints/MacOS.pl	2002-12-29 13:26:20.000000000 -0800
@@ -0,0 +1,3 @@
+# MWCPPC compiler needs to crank down the optimizations
+
+$self->{MWCPPCOptimize} = "-O1";

Modified: trunk/orca/packages/Digest-MD5-2.21/MANIFEST
==============================================================================
--- trunk/orca/packages/Digest-MD5-2.20/MANIFEST	(original)
+++ trunk/orca/packages/Digest-MD5-2.21/MANIFEST	2002-12-29 13:26:20.000000000 -0800
@@ -3,10 +3,12 @@
 MD5.pm			Digest::MD5 Perl Module
 hints/dec_osf.pl	Workaround for DEC compiler bug
 hints/irix_6.pl		Workaround for IRIX compiler bug
+hints/MacOS.pl		Workaround for Mac compiler bug
 MD5.xs			MD5 Perl 'XS' source file
 typemap			Supplementary typemap
 Makefile.PL		Perl Makefile builder
 rfc1321.txt		The MD5 Message-Digest Algorithm
+t/align.t		Try unaligned memory blocks
 t/badfile.t             Try addfile() on unopened file
 t/files.t		Check a few files.
 t/md5-aaa.t		Exercise padding code

Modified: trunk/orca/packages/Digest-MD5-2.21/Makefile.PL
==============================================================================
--- trunk/orca/packages/Digest-MD5-2.20/Makefile.PL	(original)
+++ trunk/orca/packages/Digest-MD5-2.21/Makefile.PL	2002-12-29 13:26:20.000000000 -0800
@@ -6,12 +6,23 @@
 my @extra;
 @extra = (DEFINE => "-DU32_ALIGNMENT_REQUIRED") unless free_u32_alignment();
 
+if ($^O eq 'VMS') {
+    if (defined($Config{ccname})) {
+        if (grep(/VMS_VAX/, @INC) && ($Config{ccname} eq 'DEC')) {
+            # VAX compiler optimizer even as late as v6.4 gets stuck
+            push(@extra, OPTIMIZE => "/Optimize=(NODISJOINT)");
+        }
+    }
+}
+
+
 WriteMakefile(
     'NAME'	   => 'Digest::MD5',
     'VERSION_FROM' => 'MD5.pm',
     @extra,
     'dist'         => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
 );
+exit;
 
 
 

Modified: trunk/orca/packages/Digest-MD5-2.21/Changes
==============================================================================
--- trunk/orca/packages/Digest-MD5-2.20/Changes	(original)
+++ trunk/orca/packages/Digest-MD5-2.21/Changes	2002-12-29 13:26:20.000000000 -0800
@@ -1,3 +1,17 @@
+2002-12-27   Gisle Aas <gisle at ActiveState.com>
+
+   Release 2.21
+
+   Minor tweaks sync up with bleadperl:
+     - VMS optimizer tweaks to the Makefile.PL
+     - MacOS support
+     - Added alignment test
+
+   Added example to the MD5 POD that shows how to calculate the
+   digest of Unicode strings.
+
+
+
 2002-05-05   Gisle Aas <gisle at ActiveState.com>
 
    Release 2.20




More information about the Orca-checkins mailing list