Change 11930 by jhi@alpha on 2001/09/07 11:59:17
Subject: [PATCH] Digest::MD5 update
From: Gisle Aas <[EMAIL PROTECTED]>
Date: 06 Sep 2001 23:32:56 -0700
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/ext/Digest/MD5/Changes#2 edit
... //depot/perl/ext/Digest/MD5/MD5.pm#3 edit
... //depot/perl/ext/Digest/MD5/MD5.xs#5 edit
... //depot/perl/ext/Digest/MD5/t/files.t#2 edit
Differences ...
==== //depot/perl/ext/Digest/MD5/Changes#2 (text) ====
Index: perl/ext/Digest/MD5/Changes
--- perl/ext/Digest/MD5/Changes.~1~ Fri Sep 7 06:15:05 2001
+++ perl/ext/Digest/MD5/Changes Fri Sep 7 06:15:05 2001
@@ -1,3 +1,38 @@
+2001-09-07 Gisle Aas <[EMAIL PROTECTED]>
+
+ Release 2.16
+
+ Sync up with the bleadperl version:
+ - use SvPVbyte() if avaiable
+ - fixes to make the code 'gcc -Wall'-clean
+
+
+
+2001-08-27 Gisle Aas <[EMAIL PROTECTED]>
+
+ Release 2.15
+
+ Avoid exit() in Makefile.PL and bleedperls redefinition of printf
+ in the alignment test program.
+ Patch by Doug MacEachern <[EMAIL PROTECTED]>.
+
+
+
+2001-07-18 Gisle Aas <[EMAIL PROTECTED]>
+
+ Release 2.14
+
+ Try to warn if the functional interface is used as methods,
+ i.e. Digest::MD5->md5_hex("foo") will make noise if -w is
+ enabled.
+
+ Document the missing padding for the base64 digests.
+
+ If both XS bootstrap and locating Digest::Perl::MD5 fails
+ reraise the original XS bootstrap exception.
+
+
+
2001-03-13 Gisle Aas <[EMAIL PROTECTED]>
Release 2.13
==== //depot/perl/ext/Digest/MD5/MD5.pm#3 (text) ====
Index: perl/ext/Digest/MD5/MD5.pm
--- perl/ext/Digest/MD5/MD5.pm.~1~ Fri Sep 7 06:15:05 2001
+++ perl/ext/Digest/MD5/MD5.pm Fri Sep 7 06:15:05 2001
@@ -3,7 +3,7 @@
use strict;
use vars qw($VERSION @ISA @EXPORT_OK);
-$VERSION = '2.13';
+$VERSION = '2.16'; # $Date: 2001/09/07 05:45:14 $
require Exporter;
*import = \&Exporter::import;
@@ -16,11 +16,18 @@
Digest::MD5->bootstrap($VERSION);
};
if ($@) {
- # Try to load the pure perl version
- require Digest::Perl::MD5;
+ my $olderr = $@;
+ eval {
+ # Try to load the pure perl version
+ require Digest::Perl::MD5;
- Digest::Perl::MD5->import(qw(md5 md5_hex md5_base64));
- push(@ISA, "Digest::Perl::MD5"); # make OO interface work
+ Digest::Perl::MD5->import(qw(md5 md5_hex md5_base64));
+ push(@ISA, "Digest::Perl::MD5"); # make OO interface work
+ };
+ if ($@) {
+ # restore the original error
+ die $olderr;
+ }
}
else {
*reset = \&new;
@@ -88,6 +95,10 @@
Same as md5(), but will return the digest as a base64 encoded string.
+The base64 encoded string returned is not padded to be a multiple of 4
+bytes long. If you want interoperability with other base64 encoded
+md5 digests you might want to append the string "==" to the result.
+
=back
=head1 METHODS
@@ -142,6 +153,10 @@
Same as $md5->digest, but will return the digest as a base64 encoded
string.
+The base64 encoded string returned is not padded to be a multiple of 4
+bytes long. If you want interoperability with other base64 encoded
+md5 digests you might want to append the string "==" to the result.
+
=back
@@ -215,7 +230,7 @@
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
- Copyright 1998-2000 Gisle Aas.
+ Copyright 1998-2001 Gisle Aas.
Copyright 1995-1996 Neil Winton.
Copyright 1991-1992 RSA Data Security, Inc.
==== //depot/perl/ext/Digest/MD5/MD5.xs#5 (text) ====
Index: perl/ext/Digest/MD5/MD5.xs
--- perl/ext/Digest/MD5/MD5.xs.~1~ Fri Sep 7 06:15:05 2001
+++ perl/ext/Digest/MD5/MD5.xs Fri Sep 7 06:15:05 2001
@@ -42,8 +42,9 @@
}
#endif
-/* Define this to turn on verbose debugging prints */
-#undef MD5_DEBUG
+#ifndef SvPVbyte
+ #define SvPVbyte SvPV
+#endif
/* Perl does not guarantee that U32 is exactly 32 bits. Some system
* has no integral type with exactly 32 bits. For instance, A Cray has
@@ -618,6 +619,14 @@
unsigned char digeststr[16];
PPCODE:
MD5Init(&ctx);
+ if (PL_dowarn && items > 1) {
+ data = (unsigned char *)SvPVbyte(ST(0), len);
+ if (len == 11 && memEQ("Digest::MD5", data, 11)) {
+ char *f = (ix == F_BIN) ? "md5" :
+ (ix == F_HEX) ? "md5_hex" : "md5_base64";
+ warn("&Digest::MD5::%s function probably called as method", f);
+ }
+ }
for (i = 0; i < items; i++) {
data = (unsigned char *)(SvPVbyte(ST(i), len));
MD5Update(&ctx, data, len);
==== //depot/perl/ext/Digest/MD5/t/files.t#2 (text) ====
Index: perl/ext/Digest/MD5/t/files.t
--- perl/ext/Digest/MD5/t/files.t.~1~ Fri Sep 7 06:15:05 2001
+++ perl/ext/Digest/MD5/t/files.t Fri Sep 7 06:15:05 2001
@@ -15,13 +15,13 @@
if (ord('A') == 193) { # EBCDIC
$EXPECT = <<EOT;
-95a81f17a8e6c2273aecac12d8c4cb90 ext/Digest/MD5/MD5.pm
-9cecc5dbb27bd64b98f61f558b4db378 ext/Digest/MD5/MD5.xs
+???????????????????????????????? ext/Digest/MD5/MD5.pm
+???????????????????????????????? ext/Digest/MD5/MD5.xs
EOT
} else { # ASCII
$EXPECT = <<EOT;
-3d0146bf194e4fe68733d00fba02a49e ext/Digest/MD5/MD5.pm
-5526659171a63f532d990dd73791b60e ext/Digest/MD5/MD5.xs
+bf8c3c72d071d1c0303fc9e311820708 ext/Digest/MD5/MD5.pm
+dc50ae0aea3182f4d5f1ec368b67918b ext/Digest/MD5/MD5.xs
EOT
}
@@ -126,7 +126,7 @@
#print "$file $method\n";
open(FILE, $file) or die "Can't open $file: $!";
-# Digests avove are generated on UNIX without CRLF
+# Digests above are generated on UNIX without CRLF
# so leave handles in text mode
# binmode(FILE);
my $digest = Digest::MD5->new->addfile(*FILE)->$method();
@@ -140,7 +140,7 @@
my($file) = @_;
local $/; # slurp
open(FILE, $file) or die "Can't open $file: $!";
-# Digests avove are generated on UNIX without CRLF
+# Digests above are generated on UNIX without CRLF
# so leave handles in text mode
# binmode(FILE);
my $tmp = <FILE>;
End of Patch.