diff options
Diffstat (limited to 'nix/libutil/hash.hh')
-rw-r--r-- | nix/libutil/hash.hh | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/nix/libutil/hash.hh b/nix/libutil/hash.hh index 6b5e47cd8a..ac58651a02 100644 --- a/nix/libutil/hash.hh +++ b/nix/libutil/hash.hh @@ -1,5 +1,7 @@ #pragma once +#include <gcrypt.h> + #include "types.hh" #include "serialise.hh" @@ -7,16 +9,18 @@ namespace nix { -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; +typedef enum { + htUnknown = 0, + htMD5 = GCRY_MD_MD5, + htSHA1 = GCRY_MD_SHA1, + htSHA256 = GCRY_MD_SHA256, + htSHA512 = GCRY_MD_SHA512, + htSHA3_256 = GCRY_MD_SHA3_256, + htSHA3_512 = GCRY_MD_SHA3_512, + htBLAKE2s_256 = GCRY_MD_BLAKE2S_256 +} HashType; struct Hash { |