aboutsummaryrefslogtreecommitdiff
path: root/include/Hash.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/Hash.hpp')
-rw-r--r--include/Hash.hpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/Hash.hpp b/include/Hash.hpp
index d7c90b0..bd87b69 100644
--- a/include/Hash.hpp
+++ b/include/Hash.hpp
@@ -1,7 +1,6 @@
#pragma once
#include "utils.hpp"
-#include <sodium/crypto_generichash_blake2b.h>
#include <stdexcept>
#include <unordered_map>
@@ -9,6 +8,15 @@ namespace odhtdb
{
const int HASH_BYTE_SIZE = 32;
+ // 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;
+ }
+
class HashException : public std::runtime_error
{
public:
@@ -21,6 +29,7 @@ namespace odhtdb
Hash();
// Throws HashException on failure
Hash(const void *input, const size_t inputSize);
+ Hash(const Hash &other);
void* getData() const { return (void*)data; }
size_t getSize() const { return HASH_BYTE_SIZE; }