From eda9a7bbefc5587bf1ff895a9214f450e64575fa Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 5 Mar 2018 22:45:56 +0100 Subject: Implement 'create' operation, add seeding Seeding is currently only done on the key you specify, in the future the user should request data that it can seed. --- include/Key.hpp | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'include/Key.hpp') diff --git a/include/Key.hpp b/include/Key.hpp index f7a600b..18971d1 100644 --- a/include/Key.hpp +++ b/include/Key.hpp @@ -1,7 +1,6 @@ #pragma once #include -#include namespace odhtdb { @@ -13,32 +12,4 @@ namespace odhtdb dht::InfoHash hashedKey; }; - - // Source: https://stackoverflow.com/a/11414104 (public license) - static unsigned int fnvHash(const unsigned char *key, int len) - { - unsigned int h = 2166136261; - for (int i = 0; i < len; i++) - h = (h * 16777619) ^ key[i]; - return h; - } - - struct KeyHash - { - size_t operator()(const Key &key) const - { - return fnvHash(key.hashedKey.data(), key.hashedKey.size()); - } - }; - - struct KeyCompare - { - bool operator()(const Key &lhs, const Key &rhs) const - { - return lhs.hashedKey == rhs.hashedKey; - } - }; - - template - using KeyMap = std::unordered_map; } -- cgit v1.2.3