From: Gisle Aas Date: Thu, 6 Sep 2001 23:32:56 +0000 (-0700) Subject: Digest::MD5 update X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=db2a39d535b6d8484c7749869545e2a2d2f00c6a;hp=70a6dec2023ddb804ce104624fb6280eadcec9e7;p=p5sagit%2Fp5-mst-13.2.git Digest::MD5 update Message-ID: p4raw-id: //depot/perl@11930 --- diff --git a/ext/Digest/MD5/Changes b/ext/Digest/MD5/Changes index 62c8280..224e271 100644 --- a/ext/Digest/MD5/Changes +++ b/ext/Digest/MD5/Changes @@ -1,3 +1,38 @@ +2001-09-07 Gisle Aas + + 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 + + Release 2.15 + + Avoid exit() in Makefile.PL and bleedperls redefinition of printf + in the alignment test program. + Patch by Doug MacEachern . + + + +2001-07-18 Gisle Aas + + 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 Release 2.13 diff --git a/ext/Digest/MD5/MD5.pm b/ext/Digest/MD5/MD5.pm index 7a11df9..9a109b3 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 32ba8d4..76f54cd 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 c786a5f..d2530f1 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 = <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 = ;