#pragma once #include "utils.hpp" #include #include #include namespace odhtdb { const int HASH_BYTE_SIZE = 32; 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); 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 MapHashKey = std::unordered_map; }