summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLUtils.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2016-04-12 06:05:44 +0000
committerNorbert Preining <preining@logic.at>2016-04-12 06:05:44 +0000
commit4340d42cb5033cb3bd60ba643a3491f33f999319 (patch)
tree659e48f90e9236870d5210ed2a75003fc3f51c31 /Master/tlpkg/TeXLive/TLUtils.pm
parentdbe3c5aacd7e82e3a0d4a7956c528040982307f8 (diff)
use sha256 for remote tlpdb and location checks
git-svn-id: svn://tug.org/texlive/trunk@40423 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 8df5c3c2cc5..0a9e527c516 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -99,6 +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::compare_tlpobjs($tlpA, $tlpB);
TeXLive::TLUtils::compare_tlpdbs($tlpdbA, $tlpdbB);
TeXLive::TLUtils::report_tlpdb_differences(\%ret);
@@ -173,6 +174,7 @@ BEGIN {
&create_mirror_list
&extract_mirror_entry
&tlmd5
+ &tlsha256
&wsystem
&xsystem
&run_cmd
@@ -199,6 +201,7 @@ BEGIN {
use Cwd;
use Digest::MD5;
+use Digest::SHA;
use Getopt::Long;
use File::Temp;
@@ -3579,6 +3582,20 @@ sub tlmd5 {
}
}
+sub tlsha256 {
+ my ($file) = @_;
+ if (-r $file) {
+ open(FILE, $file) || die "open($file) failed: $!";
+ binmode(FILE);
+ my $sha256hash = Digest::SHA->new(256)->addfile(*FILE)->hexdigest;
+ close(FILE);
+ return $sha256hash;
+ } else {
+ tlwarn("tlsha256, given file not readable: $file\n");
+ return "";
+ }
+}
+
#
# compare_tlpobjs
# returns a hash