about summary refs log tree commit diff
path: root/perl/lib/Nix/Manifest.pm
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-06-03T13·33+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-06-03T13·33+0200
commit94378910fb55780cc11c1d68045f5c43e269490e (patch)
tree11b77b7e8c456d6e701cbb27cdc8a60b924fad3d /perl/lib/Nix/Manifest.pm
parenta64da5915d4023d256e1bda425ea6e10c1255812 (diff)
Handle base-16 NarHash fields in signed .narinfo files
Diffstat (limited to 'perl/lib/Nix/Manifest.pm')
-rw-r--r--perl/lib/Nix/Manifest.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/perl/lib/Nix/Manifest.pm b/perl/lib/Nix/Manifest.pm
index fb4a46469a09..428decf09b54 100644
--- a/perl/lib/Nix/Manifest.pm
+++ b/perl/lib/Nix/Manifest.pm
@@ -395,12 +395,15 @@ sub deleteOldManifests {
 
 
 # Return a fingerprint of a store path to be used in binary cache
-# signatures. It contains the store path, the SHA-256 hash of the
-# contents of the path, and the references.
+# signatures. It contains the store path, the base-32 SHA-256 hash of
+# the contents of the path, and the references.
 sub fingerprintPath {
     my ($storePath, $narHash, $narSize, $references) = @_;
     die if substr($storePath, 0, length($Nix::Config::storeDir)) ne $Nix::Config::storeDir;
     die if substr($narHash, 0, 7) ne "sha256:";
+    # Convert hash from base-16 to base-32, if necessary.
+    $narHash = "sha256:" . convertHash("sha256", substr($narHash, 7), 1)
+        if length($narHash) == 71;
     die if length($narHash) != 59;
     foreach my $ref (@{$references}) {
         die if substr($ref, 0, length($Nix::Config::storeDir)) ne $Nix::Config::storeDir;