mirror of
https://github.com/NixOS/nix
synced 2025-06-29 06:21:14 +02:00
* Refactoring to support SHA-1.
This commit is contained in:
parent
d46b4262dc
commit
73992371a3
6 changed files with 36 additions and 18 deletions
|
@ -8,13 +8,23 @@
|
|||
using namespace std;
|
||||
|
||||
|
||||
typedef enum { htMD5, htSHA1 } HashType;
|
||||
|
||||
|
||||
const int md5HashSize = 16;
|
||||
const int sha1HashSize = 20;
|
||||
|
||||
|
||||
struct Hash
|
||||
{
|
||||
static const unsigned int hashSize = 16;
|
||||
unsigned char hash[hashSize];
|
||||
static const unsigned int maxHashSize = 20;
|
||||
unsigned int hashSize;
|
||||
unsigned char hash[maxHashSize];
|
||||
|
||||
HashType type;
|
||||
|
||||
/* Create a zeroed hash object. */
|
||||
Hash();
|
||||
Hash(HashType type);
|
||||
|
||||
/* Check whether two hash are equal. */
|
||||
bool operator == (const Hash & h2) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue