diff options
author | Norbert Preining <preining@logic.at> | 2016-04-12 06:07:40 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2016-04-12 06:07:40 +0000 |
commit | dd4bdccfb5d96b72900478b3d07651d6b7382e6a (patch) | |
tree | 5cf7dbac2f95bbefad89028f3d37a1aa368da687 /Master/tlpkg/TeXLive/TLUtils.pm | |
parent | e4ea0d46df62e587ae70e6ab7711ac1c013bef32 (diff) |
replace sha256 with generic checksum
We use tldigest($string) or tlchecksum($file) to generate checksum.
The algorithm can be changed at any time provided that tldigest
and tlchecksum (in TLUtils) and the setting TLConfig::ChecksumLength
are kept in sync.
git-svn-id: svn://tug.org/texlive/trunk@40429 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 0a9e527c516..6274e0b20aa 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -99,7 +99,7 @@ C<TeXLive::TLUtils> -- utilities used in TeX Live infrastructure TeXLive::TLUtils::give_ctan_mirror(); TeXLive::TLUtils::give_ctan_mirror_base(); TeXLive::TLUtils::tlmd5($path); - TeXLive::TLUtils::tlsha256($path); + TeXLive::TLUtils::tlchecksum($path); TeXLive::TLUtils::compare_tlpobjs($tlpA, $tlpB); TeXLive::TLUtils::compare_tlpdbs($tlpdbA, $tlpdbB); TeXLive::TLUtils::report_tlpdb_differences(\%ret); @@ -174,7 +174,7 @@ BEGIN { &create_mirror_list &extract_mirror_entry &tlmd5 - &tlsha256 + &tlchecksum &wsystem &xsystem &run_cmd @@ -3582,16 +3582,20 @@ sub tlmd5 { } } -sub tlsha256 { +sub tldigest { + return (Digest::SHA::sha512_hex(shift)); +} + +sub tlchecksum { my ($file) = @_; if (-r $file) { open(FILE, $file) || die "open($file) failed: $!"; binmode(FILE); - my $sha256hash = Digest::SHA->new(256)->addfile(*FILE)->hexdigest; + my $cshash = Digest::SHA->new(512)->addfile(*FILE)->hexdigest; close(FILE); - return $sha256hash; + return $cshash; } else { - tlwarn("tlsha256, given file not readable: $file\n"); + tlwarn("tlchecksum: given file not readable: $file\n"); return ""; } } |