From 29d3242e5c428d3b0e8dc9db1c81cd4053e5271c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 4 Nov 2015 16:31:06 +0100 Subject: daemon: Support SHA-512 hashes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #679. Note: on x86_64, SHA-512 is considerably faster than SHA-256 (198 MB/s versus 131 MB/s). Co-authored-by: Ludovic Courtès --- nix/libutil/hash.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'nix/libutil/hash.hh') diff --git a/nix/libutil/hash.hh b/nix/libutil/hash.hh index 8f099c4f07..6b5e47cd8a 100644 --- a/nix/libutil/hash.hh +++ b/nix/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]; -- cgit v1.2.3