diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index ea5f6c4400a9..1a8514ca3266 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -380,7 +380,6 @@ package Maintainers; 'Digest::MD5' => { 'DISTRIBUTION' => 'TODDR/Digest-MD5-2.59.tar.gz', - 'SYNCINFO' => 'root on Sat Dec 30 21:42:47 2023', 'FILES' => q[cpan/Digest-MD5], 'EXCLUDED' => [ 'rfc1321.txt', 'bin/md5sum.pl' ], }, diff --git a/cpan/Digest-MD5/MD5.pm b/cpan/Digest-MD5/MD5.pm index 65a86f4e3583..5c51d4708b80 100644 --- a/cpan/Digest-MD5/MD5.pm +++ b/cpan/Digest-MD5/MD5.pm @@ -3,7 +3,7 @@ package Digest::MD5; use strict; use warnings; -our $VERSION = '2.58_01'; +our $VERSION = '2.59'; require Exporter; *import = \&Exporter::import; @@ -27,15 +27,15 @@ eval { if ($@) { my $olderr = $@; eval { - # Try to load the pure perl version - require Digest::Perl::MD5; + # Try to load the pure perl version + require Digest::Perl::MD5; - Digest::Perl::MD5->import(qw(md5 md5_hex md5_base64)); - unshift(@ISA, "Digest::Perl::MD5"); # make OO interface work + Digest::Perl::MD5->import(qw(md5 md5_hex md5_base64)); + unshift(@ISA, "Digest::Perl::MD5"); # make OO interface work }; if ($@) { - # restore the original error - die $olderr; + # restore the original error + die $olderr; } } else { @@ -51,24 +51,24 @@ Digest::MD5 - Perl interface to the MD5 Algorithm =head1 SYNOPSIS - # Functional style - use Digest::MD5 qw(md5 md5_hex md5_base64); + # Functional style + use Digest::MD5 qw(md5 md5_hex md5_base64); - $digest = md5($data); - $digest = md5_hex($data); - $digest = md5_base64($data); + my $digest = md5($data); + my $digest = md5_hex($data); + my $digest = md5_base64($data); - # OO style - use Digest::MD5; + # OO style + use Digest::MD5; - $ctx = Digest::MD5->new; + my $ctx = Digest::MD5->new; - $ctx->add($data); - $ctx->addfile($file_handle); + $ctx->add($data); + $ctx->addfile($file_handle); - $digest = $ctx->digest; - $digest = $ctx->hexdigest; - $digest = $ctx->b64digest; + $digest = $ctx->digest; + $digest = $ctx->hexdigest; + $digest = $ctx->b64digest; =head1 DESCRIPTION @@ -157,8 +157,8 @@ stream. Example: my $md5 = Digest::MD5->new; while (<>) { - $md5->add($_); - print "Line $.: ", $md5->clone->hexdigest, "\n"; + $md5->add($_); + print "Line $.: ", $md5->clone->hexdigest, "\n"; } =item $md5->add($data,...) @@ -258,12 +258,10 @@ The above example would print out the message: The same checksum can also be calculated in OO style: use Digest::MD5; - - $md5 = Digest::MD5->new; + my $md5 = Digest::MD5->new; $md5->add('foo', 'bar'); $md5->add('baz'); - $digest = $md5->hexdigest; - + my $digest = $md5->hexdigest; print "Digest is $digest\n"; With OO style, you can break the message arbitrarily. This means that we @@ -278,7 +276,7 @@ This is useful when calculating checksum for files: open (my $fh, '<', $filename) or die "Can't open '$filename': $!"; binmode($fh); - $md5 = Digest::MD5->new; + my $md5 = Digest::MD5->new; while (<$fh>) { $md5->add($_); } diff --git a/cpan/Digest-MD5/MD5.xs b/cpan/Digest-MD5/MD5.xs index f42fd156cad2..581b0e6aa70a 100644 --- a/cpan/Digest-MD5/MD5.xs +++ b/cpan/Digest-MD5/MD5.xs @@ -461,7 +461,7 @@ static MD5_CTX* get_md5_ctx(pTHX_ SV* sv) for (mg = SvMAGIC(SvRV(sv)); mg; mg = mg->mg_moremagic) { if (mg->mg_type == PERL_MAGIC_ext - && mg->mg_virtual == (const MGVTBL * const)&vtbl_md5) { + && mg->mg_virtual == (const MGVTBL *)&vtbl_md5) { return (MD5_CTX *)mg->mg_ptr; } } @@ -483,7 +483,7 @@ static SV * new_md5_ctx(pTHX_ MD5_CTX *context, const char *klass) #ifdef USE_ITHREADS mg = #endif - sv_magicext(sv, NULL, PERL_MAGIC_ext, (const MGVTBL * const)&vtbl_md5, (const char *)context, 0); + sv_magicext(sv, NULL, PERL_MAGIC_ext, (const MGVTBL *)&vtbl_md5, (const char *)context, 0); #if defined(USE_ITHREADS) && defined(MGf_DUP) mg->mg_flags |= MGf_DUP; diff --git a/cpan/Digest-MD5/t/files.t b/cpan/Digest-MD5/t/files.t index 01c785009b28..7d2bc0b0c4e0 100644 --- a/cpan/Digest-MD5/t/files.t +++ b/cpan/Digest-MD5/t/files.t @@ -15,14 +15,14 @@ my $EXPECT; if (ord "A" == 193) { # EBCDIC $EXPECT = <new->add($data)->digest ne $md5bin) { - print "$file: MD5->new->add(...)->digest failed\n"; - $failed++; - } - if (Digest::MD5->new->add($data)->hexdigest ne $md5hex) { - print "$file: MD5->new->add(...)->hexdigest failed\n"; - $failed++; - } - if ($B64 && Digest::MD5->new->add($data)->b64digest ne $md5b64) { - print "$file: MD5->new->add(...)->b64digest failed\n"; - $failed++; - } - - my @data = split //, $data; - if (md5(@data) ne $md5bin) { - print "$file: md5(\@data) failed\n"; - $failed++; - } - if (Digest::MD5->new->add(@data)->digest ne $md5bin) { - print "$file: MD5->new->add(\@data)->digest failed\n"; - $failed++; - } - my $md5 = Digest::MD5->new; - for (@data) { - $md5->add($_); - } - if ($md5->digest ne $md5bin) { - print "$file: $md5->add()-loop failed\n"; - $failed++; - } - - print "not " if $failed; - print "ok ", ++$testno, "\n"; + if ($file eq 'rfc1321.txt' or $file eq 'README') { + print "ok ", ++$testno, " # Skip: PERL_CORE\n"; + next; + } + } +# print "# file = $file\n"; + unless (-f $file) { + warn "No such file: $file\n"; + next; + } + if ($ENV{EBCDIC_MD5SUM}) { + require Encode; + my $data = cat_file($file); + Encode::from_to($data, 'latin1', 'cp1047'); + print md5_hex($data), " $base\n"; + next; + } + my $md5bin = pack("H*", $md5hex); + my $md5b64; + if ($B64) { + $md5b64 = MIME::Base64::encode($md5bin, ""); + chop($md5b64); chop($md5b64); # remove padding + } + my $failed; + my $got; + + if (digest_file($file, 'digest') ne $md5bin) { + print "$file: Bad digest\n"; + $failed++; + } + + if (($got = digest_file($file, 'hexdigest')) ne $md5hex) { + print "$file: Bad hexdigest: got $got expected $md5hex\n"; + $failed++; + } + + if ($B64 && digest_file($file, 'b64digest') ne $md5b64) { + print "$file: Bad b64digest\n"; + $failed++; + } + + my $data = cat_file($file); + if (md5($data) ne $md5bin) { + print "$file: md5() failed\n"; + $failed++; + } + if (md5_hex($data) ne $md5hex) { + print "$file: md5_hex() failed\n"; + $failed++; + } + if ($B64 && md5_base64($data) ne $md5b64) { + print "$file: md5_base64() failed\n"; + $failed++; + } + + if (Digest::MD5->new->add($data)->digest ne $md5bin) { + print "$file: MD5->new->add(...)->digest failed\n"; + $failed++; + } + if (Digest::MD5->new->add($data)->hexdigest ne $md5hex) { + print "$file: MD5->new->add(...)->hexdigest failed\n"; + $failed++; + } + if ($B64 && Digest::MD5->new->add($data)->b64digest ne $md5b64) { + print "$file: MD5->new->add(...)->b64digest failed\n"; + $failed++; + } + + my @data = split //, $data; + if (md5(@data) ne $md5bin) { + print "$file: md5(\@data) failed\n"; + $failed++; + } + if (Digest::MD5->new->add(@data)->digest ne $md5bin) { + print "$file: MD5->new->add(\@data)->digest failed\n"; + $failed++; + } + my $md5 = Digest::MD5->new; + for (@data) { + $md5->add($_); + } + if ($md5->digest ne $md5bin) { + print "$file: $md5->add()-loop failed\n"; + $failed++; + } + + print "not " if $failed; + print "ok ", ++$testno, "\n"; } @@ -163,4 +163,3 @@ sub cat_file close(FILE); $tmp; } -