aboutsummaryrefslogtreecommitdiff
path: root/src/hash.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-05-06 20:41:28 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2016-05-17 20:04:42 +0200
commit0b1295b066b9369decb2e664e60b0129dbc30dfb (patch)
tree3a02f501e4e3c12877b748304d176aea5da97b49 /src/hash.h
parent1f01443567b03ac75a91c810f1733f5c21b5699d (diff)
Add SipHash-2-4 primitives to hash
Diffstat (limited to 'src/hash.h')
-rw-r--r--src/hash.h15
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