summaryrefslogtreecommitdiff
path: root/ext/Digest
diff options
context:
space:
mode:
authorGisle Aas <gisle@aas.no>2001-09-06 16:32:56 -0700
committerJarkko Hietaniemi <jhi@iki.fi>2001-09-07 11:59:17 +0000
commitdb2a39d535b6d8484c7749869545e2a2d2f00c6a (patch)
treea6d226221f5510c982e0220405bd2b506ef9f836 /ext/Digest
parent70a6dec2023ddb804ce104624fb6280eadcec9e7 (diff)
downloadperl-db2a39d535b6d8484c7749869545e2a2d2f00c6a.tar.gz
Digest::MD5 update
Message-ID: <lrofon5x47.fsf@caliper.ActiveState.com> p4raw-id: //depot/perl@11930
Diffstat (limited to 'ext/Digest')
-rw-r--r--ext/Digest/MD5/Changes35
-rw-r--r--ext/Digest/MD5/MD5.pm29
-rw-r--r--ext/Digest/MD5/MD5.xs13
-rw-r--r--ext/Digest/MD5/t/files.t12
4 files changed, 74 insertions, 15 deletions
diff --git a/ext/Digest/MD5/Changes b/ext/Digest/MD5/Changes
index 62c828075c..224e27174c 100644
--- a/ext/Digest/MD5/Changes
+++ b/ext/Digest/MD5/Changes
@@ -1,3 +1,38 @@
+2001-09-07 Gisle Aas <gisle@ActiveState.com>
+
+ 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 <gisle@ActiveState.com>
+
+ Release 2.15
+
+ Avoid exit() in Makefile.PL and bleedperls redefinition of printf
+ in the alignment test program.
+ Patch by Doug MacEachern <dougm@covalent.net>.
+
+
+
+2001-07-18 Gisle Aas <gisle@ActiveState.com>
+
+ 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 <gisle@ActiveState.com>
Release 2.13
diff --git a/ext/Digest/MD5/MD5.pm b/ext/Digest/MD5/MD5.pm
index 7a11df9e56..9a109b34e5 100644
--- a/ext/Digest/MD5/MD5.pm
+++ b/ext/Digest/MD5/MD5.pm
@@ -3,7 +3,7 @@ package Digest::MD5;
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 @@ eval {
Digest::MD5->bootstrap($VERSION);
};
if ($@) {
- # 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
+ 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
+ };
+ if ($@) {
+ # restore the original error
+ die $olderr;
+ }
}
else {
*reset = \&new;
@@ -88,6 +95,10 @@ Same as md5(), but will return the digest in hexadecimal form.
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 in hexadecimal form.
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 @@ RFC 1321
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.
diff --git a/ext/Digest/MD5/MD5.xs b/ext/Digest/MD5/MD5.xs
index 32ba8d4c7c..76f54cda88 100644
--- a/ext/Digest/MD5/MD5.xs
+++ b/ext/Digest/MD5/MD5.xs
@@ -42,8 +42,9 @@ extern "C" {
}
#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 @@ md5(...)
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);
diff --git a/ext/Digest/MD5/t/files.t b/ext/Digest/MD5/t/files.t
index c786a5f4e5..d2530f1bec 100644
--- a/ext/Digest/MD5/t/files.t
+++ b/ext/Digest/MD5/t/files.t
@@ -15,13 +15,13 @@ my $EXPECT;
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 @@ sub digest_file
#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 @@ sub cat_file
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>;