From 5a8727e34b938b70623ca865273fd81c7604b461 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 13 Mar 2018 06:26:06 +0100 Subject: Expose include dir --- include/Hash.hpp | 58 -------------------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 include/Hash.hpp (limited to 'include/Hash.hpp') diff --git a/include/Hash.hpp b/include/Hash.hpp deleted file mode 100644 index 9dce168..0000000 --- a/include/Hash.hpp +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once - -#include "utils.hpp" -#include -#include -#include - -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: - HashException(const std::string &errMsg) : std::runtime_error(errMsg) {} - }; - - class Hash - { - public: - 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; } - - size_t operator()() const; - bool operator==(const Hash &other) const; - - std::string toString() const; - private: - char data[HASH_BYTE_SIZE]; - }; - - struct HashHasher - { - size_t operator()(const Hash &hash) const - { - return hash(); - } - }; - - template - using MapHash = std::unordered_map; - - using SetHash = std::unordered_set; -} -- cgit v1.2.3