1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 06:21:14 +02:00

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).
This commit is contained in:
Eelco Dolstra 2015-11-04 16:31:06 +01:00
parent a6ca68a70c
commit 6f1743b1a5
6 changed files with 30 additions and 17 deletions

View file

@ -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];