aboutsummaryrefslogtreecommitdiff
path: root/src/Hash.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hash.cpp')
-rw-r--r--src/Hash.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/Hash.cpp b/src/Hash.cpp
index 5d2f914..91bc062 100644
--- a/src/Hash.cpp
+++ b/src/Hash.cpp
@@ -17,15 +17,6 @@ namespace odhtdb
static SodiumInitializer __sodiumInitializer;
- // Source: https://stackoverflow.com/a/11414104 (public license)
- static size_t fnvHash(const unsigned char *key, int len)
- {
- size_t h = 2166136261;
- for (int i = 0; i < len; i++)
- h = (h * 16777619) ^ key[i];
- return h;
- }
-
Hash::Hash()
{
memset(data, 0, HASH_BYTE_SIZE);
@@ -38,6 +29,11 @@ namespace odhtdb
throw HashException("Failed to hash data using blake2b");
}
+ Hash::Hash(const Hash &other)
+ {
+ memcpy(data, other.data, HASH_BYTE_SIZE);
+ }
+
size_t Hash::operator()() const
{
return fnvHash((const unsigned char*)data, HASH_BYTE_SIZE);