From ab1ea29ba1b8379a21fabd3dc859552c470a6421 Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 31 Jan 2022 19:32:59 +0700 Subject: refactor: make GetRand a template, remove GetRandInt --- src/util/bytevectorhash.cpp | 6 +++--- src/util/hasher.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/util') diff --git a/src/util/bytevectorhash.cpp b/src/util/bytevectorhash.cpp index bc060a44c9..9054db4759 100644 --- a/src/util/bytevectorhash.cpp +++ b/src/util/bytevectorhash.cpp @@ -6,10 +6,10 @@ #include #include -ByteVectorHash::ByteVectorHash() +ByteVectorHash::ByteVectorHash() : + m_k0(GetRand()), + m_k1(GetRand()) { - GetRandBytes({reinterpret_cast(&m_k0), sizeof(m_k0)}); - GetRandBytes({reinterpret_cast(&m_k1), sizeof(m_k1)}); } size_t ByteVectorHash::operator()(const std::vector& input) const diff --git a/src/util/hasher.cpp b/src/util/hasher.cpp index 5900daf050..c21941eb88 100644 --- a/src/util/hasher.cpp +++ b/src/util/hasher.cpp @@ -7,11 +7,11 @@ #include -SaltedTxidHasher::SaltedTxidHasher() : k0(GetRand(std::numeric_limits::max())), k1(GetRand(std::numeric_limits::max())) {} +SaltedTxidHasher::SaltedTxidHasher() : k0(GetRand()), k1(GetRand()) {} -SaltedOutpointHasher::SaltedOutpointHasher() : k0(GetRand(std::numeric_limits::max())), k1(GetRand(std::numeric_limits::max())) {} +SaltedOutpointHasher::SaltedOutpointHasher() : k0(GetRand()), k1(GetRand()) {} -SaltedSipHasher::SaltedSipHasher() : m_k0(GetRand(std::numeric_limits::max())), m_k1(GetRand(std::numeric_limits::max())) {} +SaltedSipHasher::SaltedSipHasher() : m_k0(GetRand()), m_k1(GetRand()) {} size_t SaltedSipHasher::operator()(const Span& script) const { -- cgit v1.2.3