void hash256 (uint8_t* dest, const uint8_t* src, size_t n) { CSHA256 hash; hash.Write(src, n); hash.Finalize(dest); hash.Reset(); hash.Write(dest, 32); hash.Finalize(dest); }
void hash160 (uint8_t* dest, const uint8_t* src, size_t n) { CSHA256 hash; hash.Write(src, n); hash.Finalize(dest); CRIPEMD160 hashR; hashR.Write(dest, 32); hashR.Finalize(dest); }
void CBlockHeaderAndShortTxIDs::FillShortTxIDSelector() const { CDataStream stream(SER_NETWORK, PROTOCOL_VERSION); stream << header << nonce; CSHA256 hasher; hasher.Write((unsigned char*)&(*stream.begin()), stream.end() - stream.begin()); uint256 shorttxidhash; hasher.Finalize(shorttxidhash.begin()); shorttxidk0 = shorttxidhash.GetUint64(0); shorttxidk1 = shorttxidhash.GetUint64(1); }
void sha256 (uint8_t* dest, const uint8_t* src, size_t n) { CSHA256 hash; hash.Write(src, n); hash.Finalize(dest); }