mirror of
https://github.com/NixOS/nix
synced 2025-06-29 06:21:14 +02:00
* Add SHA-256.
* Tests for the various hashes.
This commit is contained in:
parent
37b51a9aa6
commit
63791eb05b
9 changed files with 912 additions and 8 deletions
|
@ -8,11 +8,12 @@
|
|||
using namespace std;
|
||||
|
||||
|
||||
typedef enum { htMD5, htSHA1 } HashType;
|
||||
typedef enum { htMD5, htSHA1, htSHA256 } HashType;
|
||||
|
||||
|
||||
const int md5HashSize = 16;
|
||||
const int sha1HashSize = 20;
|
||||
const int sha256HashSize = 32;
|
||||
|
||||
|
||||
struct Hash
|
||||
|
@ -53,8 +54,7 @@ Hash hashString(const string & s, HashType ht);
|
|||
Hash hashFile(const Path & path, HashType ht);
|
||||
|
||||
/* Compute the hash of the given path. The hash is defined as
|
||||
md5(dump(path)).
|
||||
*/
|
||||
md5(dump(path)). */
|
||||
Hash hashPath(const Path & path, HashType ht);
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue