16 uint32_t h1 = nHashSeed;
17 const uint32_t c1 = 0xcc9e2d51;
18 const uint32_t c2 = 0x1b873593;
20 const int nblocks = vDataToHash.
size() / 4;
24 const uint8_t* blocks = vDataToHash.
data();
26 for (
int i = 0; i < nblocks; ++i) {
27 uint32_t k1 =
ReadLE32(blocks + i*4);
35 h1 = h1 * 5 + 0xe6546b64;
40 const uint8_t* tail = vDataToHash.
data() + nblocks * 4;
44 switch (vDataToHash.
size() & 3) {
61 h1 ^= vDataToHash.
size();
71void BIP32Hash(
const ChainCode &chainCode,
unsigned int nChild,
unsigned char header,
const unsigned char data[32],
unsigned char output[64])
90 writer << taghash << taghash;
A hasher class for HMAC-SHA-512.
CHMAC_SHA512 & Write(const unsigned char *data, size_t len)
void Finalize(unsigned char hash[OUTPUT_SIZE])
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).
uint256 SHA256Uint256(const uint256 &input)
Single-SHA256 a 32-byte input (represented as uint256).
static SECP256K1_INLINE uint64_t rotl(const uint64_t x, int k)