summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/CPANPLUS/Module/Checksums.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/CPANPLUS/Module/Checksums.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/CPANPLUS/Module/Checksums.pm19
1 files changed, 10 insertions, 9 deletions
diff --git a/Master/tlpkg/tlperl/lib/CPANPLUS/Module/Checksums.pm b/Master/tlpkg/tlperl/lib/CPANPLUS/Module/Checksums.pm
index e1a2bbdb6ad..3f9561e2dfe 100644
--- a/Master/tlpkg/tlperl/lib/CPANPLUS/Module/Checksums.pm
+++ b/Master/tlpkg/tlperl/lib/CPANPLUS/Module/Checksums.pm
@@ -75,7 +75,7 @@ sub _validate_checksum {
### if we can't check it, we must assume it's ok ###
return $self->status->checksum_ok(1)
- unless can_load( modules => { 'Digest::MD5' => '0.0' } );
+ unless can_load( modules => { 'Digest::SHA' => '0.0' } );
#class CPANPLUS::Module::Status is runtime-generated
my $file = $self->_get_checksums_file( verbose => $verbose ) or (
@@ -103,29 +103,30 @@ sub _validate_checksum {
msg(loc("Archive size is not known for '%1'",$self->package),$verbose);
}
- my $md5 = $href->{ $self->package }->{'md5'};
+ my $sha = $href->{ $self->package }->{'sha256'};
- unless( defined $md5 ) {
- msg(loc("No 'md5' checksum known for '%1'",$self->package),$verbose);
+ unless( defined $sha ) {
+ msg(loc("No 'sha256' checksum known for '%1'",$self->package),$verbose);
return $self->status->checksum_ok(1);
}
- $self->status->checksum_value($md5);
+ $self->status->checksum_value($sha);
my $fh = FileHandle->new( $self->status->fetch ) or return;
binmode $fh;
- my $ctx = Digest::MD5->new;
+ my $ctx = Digest::SHA->new(256);
$ctx->addfile( $fh );
- my $flag = $ctx->hexdigest eq $md5;
+ my $hexdigest = $ctx->hexdigest;
+ my $flag = $hexdigest eq $sha;
$flag
? msg(loc("Checksum matches for '%1'", $self->package),$verbose)
: error(loc("Checksum does not match for '%1': " .
- "MD5 is '%2' but should be '%3'",
- $self->package, $ctx->hexdigest, $md5),$verbose);
+ "SHA256 is '%2' but should be '%3'",
+ $self->package, $hexdigest, $sha),$verbose);
return $self->status->checksum_ok(1) if $flag;