11 inline uint32_t
ROTL32(uint32_t x, int8_t r)
13 return (x << r) | (x >> (32 - r));
19 uint32_t h1 = nHashSeed;
20 const uint32_t c1 = 0xcc9e2d51;
21 const uint32_t c2 = 0x1b873593;
23 const int nblocks = vDataToHash.
size() / 4;
27 const uint8_t* blocks = vDataToHash.
data();
29 for (
int i = 0; i < nblocks; ++i) {
38 h1 = h1 * 5 + 0xe6546b64;
43 const uint8_t* tail = vDataToHash.
data() + nblocks * 4;
47 switch (vDataToHash.
size() & 3) {
62 h1 ^= vDataToHash.
size();
72 void BIP32Hash(
const ChainCode &chainCode,
unsigned int nChild,
unsigned char header,
const unsigned char data[32],
unsigned char output[64])
75 num[0] = (nChild >> 24) & 0xFF;
76 num[1] = (nChild >> 16) & 0xFF;
77 num[2] = (nChild >> 8) & 0xFF;
78 num[3] = (nChild >> 0) & 0xFF;
93 CSHA256().
Write((
const unsigned char*)tag.data(), tag.size()).Finalize(taghash.
begin());
94 writer << taghash << taghash;
CHashWriter TaggedHash(const std::string &tag)
Return a CHashWriter primed for tagged hashes (as specified in BIP 340).
void Finalize(unsigned char hash[OUTPUT_SIZE])
CSHA256 & Write(const unsigned char *data, size_t len)
CHMAC_SHA512 & Write(const unsigned char *data, size_t len)
constexpr std::size_t size() const noexcept
unsigned int MurmurHash3(unsigned int nHashSeed, Span< const unsigned char > vDataToHash)
void BIP32Hash(const ChainCode &chainCode, unsigned int nChild, unsigned char header, const unsigned char data[32], unsigned char output[64])
static const unsigned char k1[32]
unsigned int size() const
static uint32_t ReadLE32(const unsigned char *ptr)
uint256 SHA256Uint256(const uint256 &input)
Single-SHA256 a 32-byte input (represented as uint256).
constexpr C * data() const noexcept
A writer stream (for serialization) that computes a 256-bit hash.
A Span is an object that can refer to a contiguous sequence of objects.
A hasher class for SHA-256.
uint32_t ROTL32(uint32_t x, int8_t r)
A hasher class for HMAC-SHA-512.