diff options
author | Andrew Chow <achow101-github@achow101.com> | 2019-09-17 17:02:56 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2020-11-10 14:33:37 -0500 |
commit | 95e61c1cf2a91d041c8025306ba36f0ea2806894 (patch) | |
tree | 225cae6060841c5049f9722b48776dd8901d4f59 /src/script | |
parent | 42f950cb27b732782d55282cdcd934396fcd7071 (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/script')
-rw-r--r-- | src/script/sigcache.h | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/script/sigcache.h b/src/script/sigcache.h index 00534f9758..a945df0cc0 100644 --- a/src/script/sigcache.h +++ b/src/script/sigcache.h @@ -8,6 +8,7 @@ #include <script/interpreter.h> #include <span.h> +#include <util/hasher.h> #include <vector> @@ -20,27 +21,6 @@ static const int64_t MAX_MAX_SIG_CACHE_SIZE = 16384; class CPubKey; -/** - * We're hashing a nonce into the entries themselves, so we don't need extra - * blinding in the set hash computation. - * - * This may exhibit platform endian dependent behavior but because these are - * nonced hashes (random) and this state is only ever used locally it is safe. - * All that matters is local consistency. - */ -class SignatureCacheHasher -{ -public: - template <uint8_t hash_select> - uint32_t operator()(const uint256& key) const - { - static_assert(hash_select <8, "SignatureCacheHasher only has 8 hashes available."); - uint32_t u; - std::memcpy(&u, key.begin()+4*hash_select, 4); - return u; - } -}; - class CachingTransactionSignatureChecker : public TransactionSignatureChecker { private: |