about summary refs log tree commit diff
path: root/src/libutil/hash.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-13T15·44+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-13T15·44+0000
commit73992371a3bc16b27b22e53d5f7ae600dea9cf60 (patch)
treed1e5db8cea5caacff34ac4e9b61195b97dbd9ceb /src/libutil/hash.hh
parentd46b4262dc84689c3916583b91ed9fc6dafefdd6 (diff)
* Refactoring to support SHA-1.
Diffstat (limited to 'src/libutil/hash.hh')
-rw-r--r--src/libutil/hash.hh16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/libutil/hash.hh b/src/libutil/hash.hh
index 0062f987c021..0b5e46cc6b65 100644
--- a/src/libutil/hash.hh
+++ b/src/libutil/hash.hh
@@ -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;