diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-05-18 10:59:00 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-05-18 11:01:42 +0200 |
commit | 5e374f73060d32c7c3700cb521095ee2dc425d9c (patch) | |
tree | 815afcedd6e2b38979aefd7e3c230a5f4f5938c3 /src/hash.h | |
parent | 5c3f8ddcaa1164079105c452429fccf8127b01b6 (diff) | |
parent | a68ec21f7ed2978d8945a0f4cfd7e80bfa5fd917 (diff) | |
download | bitcoin-5e374f73060d32c7c3700cb521095ee2dc425d9c.tar.xz |
Merge #8020: Use SipHash-2-4 for various non-cryptographic hashes
a68ec21 Use SipHash-2-4 for address relay selection (Pieter Wuille)
8cc9cfe Switch CTxMempool::mapTx to use a hash index for txids (Pieter Wuille)
382c871 Use SipHash-2-4 for CCoinsCache index (Pieter Wuille)
0b1295b Add SipHash-2-4 primitives to hash (Pieter Wuille)
Diffstat (limited to 'src/hash.h')
-rw-r--r-- | src/hash.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/hash.h b/src/hash.h index 97955c8d5a..600dabec56 100644 --- a/src/hash.h +++ b/src/hash.h @@ -171,4 +171,19 @@ unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char void BIP32Hash(const ChainCode &chainCode, unsigned int nChild, unsigned char header, const unsigned char data[32], unsigned char output[64]); +/** SipHash-2-4, using a uint64_t-based (rather than byte-based) interface */ +class CSipHasher +{ +private: + uint64_t v[4]; + int count; + +public: + CSipHasher(uint64_t k0, uint64_t k1); + CSipHasher& Write(uint64_t data); + uint64_t Finalize() const; +}; + +uint64_t SipHashUint256(uint64_t k0, uint64_t k1, const uint256& val); + #endif // BITCOIN_HASH_H |