MCPcopy Create free account
hub / github.com/ElementsProject/elements / CSipHasher

Class CSipHasher

src/crypto/siphash.h:13–32  ·  view source on GitHub ↗

SipHash-2-4 */

Source from the content-addressed store, hash-verified

11
12/** SipHash-2-4 */
13class CSipHasher
14{
15private:
16 uint64_t v[4];
17 uint64_t tmp;
18 uint8_t count; // Only the low 8 bits of the input size matter.
19
20public:
21 /** Construct a SipHash calculator initialized with 128-bit key (k0, k1) */
22 CSipHasher(uint64_t k0, uint64_t k1);
23 /** Hash a 64-bit integer worth of data
24 * It is treated as if this was the little-endian interpretation of 8 bytes.
25 * This function can only be used when a multiple of 8 bytes have been written so far.
26 */
27 CSipHasher& Write(uint64_t data);
28 /** Hash arbitrary bytes. */
29 CSipHasher& Write(const unsigned char* data, size_t size);
30 /** Compute the 64-bit SipHash-2-4 of the data written so far. The object remains untouched. */
31 uint64_t Finalize() const;
32};
33
34/** Optimized SipHash-2-4 implementation for uint256.
35 *

Callers 9

RelayAddressMethod · 0.85
operator()Method · 0.85
operator()Method · 0.85
HashToRangeMethod · 0.85
HashToRangeFunction · 0.85
InitializerMethod · 0.85
operator()Method · 0.85
operator()Method · 0.85

Calls

no outgoing calls

Tested by 2

HashToRangeFunction · 0.68
InitializerMethod · 0.68