mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-11 21:22:47 +01:00
Add generic SaltedSipHasher
SaltedSipHasher is a generic hasher that can be used with most things we would hash in an unordered container.
This commit is contained in:
@@ -10,3 +10,10 @@
|
||||
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())) {}
|
||||
|
||||
SaltedSipHasher::SaltedSipHasher() : m_k0(GetRand(std::numeric_limits<uint64_t>::max())), m_k1(GetRand(std::numeric_limits<uint64_t>::max())) {}
|
||||
|
||||
size_t SaltedSipHasher::operator()(const Span<const unsigned char>& script) const
|
||||
{
|
||||
return CSipHasher(m_k0, m_k1).Write(script.data(), script.size()).Finalize();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user