aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/hash.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-11-04 16:31:06 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-11-04 16:37:49 +0100
commit6f1743b1a5116ca57a60b481ee4083c891b7a334 (patch)
treee18f095051d8126b7f782355f2deba529faa2770 /src/libutil/hash.hh
parenta6ca68a70c3bc0b2e6abad70346c99642a896f9f (diff)
Support SHA-512 hashes
Fixes #679. Note: on x86_64, SHA-512 is considerably faster than SHA-256 (198 MB/s versus 131 MB/s).
Diffstat (limited to 'src/libutil/hash.hh')
-rw-r--r--src/libutil/hash.hh5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libutil/hash.hh b/src/libutil/hash.hh
index 2c6f176ec..841b4cb29 100644
--- a/src/libutil/hash.hh
+++ b/src/libutil/hash.hh
@@ -7,19 +7,20 @@
namespace nix {
-typedef enum { htUnknown, htMD5, htSHA1, htSHA256 } HashType;
+typedef enum { htUnknown, htMD5, htSHA1, htSHA256, htSHA512 } HashType;
const int md5HashSize = 16;
const int sha1HashSize = 20;
const int sha256HashSize = 32;
+const int sha512HashSize = 64;
extern const string base32Chars;
struct Hash
{
- static const unsigned int maxHashSize = 32;
+ static const unsigned int maxHashSize = 64;
unsigned int hashSize;
unsigned char hash[maxHashSize];