aboutsummaryrefslogtreecommitdiff
path: root/src/util/hasher.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-09-17 17:02:56 -0400
committerAndrew Chow <achow101-github@achow101.com>2020-11-10 14:33:37 -0500
commit95e61c1cf2a91d041c8025306ba36f0ea2806894 (patch)
tree225cae6060841c5049f9722b48776dd8901d4f59 /src/util/hasher.cpp
parent42f950cb27b732782d55282cdcd934396fcd7071 (diff)
Move Hashers to util/hasher.{cpp/h}
Move the hashers that we use for hash tables to a common place. Moved hashers: - SaltedTxidHasher - SaltedOutpointHasher - FilterHeaderHasher - SignatureCacheHasher - BlockHasher
Diffstat (limited to 'src/util/hasher.cpp')
-rw-r--r--src/util/hasher.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/hasher.cpp b/src/util/hasher.cpp
new file mode 100644
index 0000000000..236b8e926f
--- /dev/null
+++ b/src/util/hasher.cpp
@@ -0,0 +1,12 @@
+// Copyright (c) 2019 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#include <random.h>
+#include <util/hasher.h>
+
+#include <limits>
+
+SaltedTxidHasher::SaltedTxidHasher() : k0(GetRand(std::numeric_limits<uint64_t>::max())), k1(GetRand(std::numeric_limits<uint64_t>::max())) {}
+
+SaltedOutpointHasher::SaltedOutpointHasher() : k0(GetRand(std::numeric_limits<uint64_t>::max())), k1(GetRand(std::numeric_limits<uint64_t>::max())) {}