Crypto: added cache for faster key derivation

This commit is contained in:
SChernykh
2021-09-14 11:06:49 +02:00
parent ba6a2c8eb2
commit b35b4a9f76
6 changed files with 124 additions and 90 deletions
+13
View File
@@ -136,4 +136,17 @@ struct hash<p2pool::hash>
}
};
template<size_t N>
struct hash<std::array<uint8_t, N>>
{
FORCEINLINE size_t operator()(const std::array<uint8_t, N>& value) const
{
uint64_t result = 0xcbf29ce484222325ull;
for (size_t i = 0; i < N; ++i) {
result = (result ^ value[i]) * 0x100000001b3ull;
}
return static_cast<size_t>(result);
}
};
} // namespace std