summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-14 13:51:38 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-14 13:51:38 +0000
commit9530cc31700f68fd229eee69eabd2baa099f404a (patch)
tree5cc317adeb0c8098d8a9197a0bcbcb29ee4d941d /src/libutil
parenta7b94e87d7d28f763a708876cba46c8f2484b526 (diff)
downloadguix-9530cc31700f68fd229eee69eabd2baa099f404a.tar.gz
* Start move towards SHA-256 hashes instead of MD5.
* Start cleaning up unique store path generation (they weren't always
  unique; in particular the suffix ("-aterm-2.2", "-builder.sh") was
  not part of the hash, therefore changes to the suffix would cause
  multiple store objects with the same hash).

Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/hash.cc1
-rw-r--r--src/libutil/hash.hh2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc
index 599d375dca..cd7043090e 100644
--- a/src/libutil/hash.cc
+++ b/src/libutil/hash.cc
@@ -22,6 +22,7 @@ Hash::Hash(HashType type)
     else if (type == htSHA1) hashSize = sha1HashSize;
     else if (type == htSHA256) hashSize = sha256HashSize;
     else throw Error("unknown hash type");
+    assert(hashSize <= maxHashSize);
     memset(hash, 0, hashSize);
 }
 
diff --git a/src/libutil/hash.hh b/src/libutil/hash.hh
index d82cd87a21..4490d2ff7a 100644
--- a/src/libutil/hash.hh
+++ b/src/libutil/hash.hh
@@ -18,7 +18,7 @@ const int sha256HashSize = 32;
 
 struct Hash
 {
-    static const unsigned int maxHashSize = 20;
+    static const unsigned int maxHashSize = 32;
     unsigned int hashSize;
     unsigned char hash[maxHashSize];