12 inline uint32_t
ROTL32(uint32_t x, int8_t r)
14 return (x << r) | (x >> (32 - r));
20 uint32_t h1 = nHashSeed;
21 const uint32_t c1 = 0xcc9e2d51;
22 const uint32_t c2 = 0x1b873593;
24 const int nblocks = vDataToHash.
size() / 4;
28 const uint8_t* blocks = vDataToHash.
data();
30 for (
int i = 0; i < nblocks; ++i) {
39 h1 = h1 * 5 + 0xe6546b64;
44 const uint8_t* tail = vDataToHash.
data() + nblocks * 4;
48 switch (vDataToHash.
size() & 3) {
65 h1 ^= vDataToHash.
size();
75 void BIP32Hash(
const ChainCode &chainCode,
unsigned int nChild,
unsigned char header,
const unsigned char data[32],
unsigned char output[64])
94 writer << taghash << taghash;
static const unsigned char k1[32]
A hasher class for HMAC-SHA-512.
void Finalize(unsigned char hash[OUTPUT_SIZE])
CHMAC_SHA512 & Write(const unsigned char *data, size_t len)
A hasher class for SHA-256.
void Finalize(unsigned char hash[OUTPUT_SIZE])
CSHA256 & Write(const unsigned char *data, size_t len)
A writer stream (for serialization) that computes a 256-bit hash.
constexpr std::size_t size() const noexcept
constexpr C * data() const noexcept
static constexpr unsigned int size()
constexpr unsigned char * begin()
static uint32_t ReadLE32(const unsigned char *ptr)
static void WriteBE32(unsigned char *ptr, uint32_t x)
void BIP32Hash(const ChainCode &chainCode, unsigned int nChild, unsigned char header, const unsigned char data[32], unsigned char output[64])
unsigned int MurmurHash3(unsigned int nHashSeed, Span< const unsigned char > vDataToHash)
HashWriter TaggedHash(const std::string &tag)
Return a HashWriter primed for tagged hashes (as specified in BIP 340).
uint32_t ROTL32(uint32_t x, int8_t r)
uint256 SHA256Uint256(const uint256 &input)
Single-SHA256 a 32-byte input (represented as uint256).