Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
251if (bufsize && bufsize + len >= 64) {252// Fill the buffer, and process it.253memcpy(buf + bufsize, data, 64 - bufsize);254bytes += 64 - bufsize;255data += 64 - bufsize;256ripemd160::Transform(s, buf);257bufsize = 0;258}259while (end - data >= 64) {260// Process full chunks directly from the source.261ripemd160::Transform(s, data);262bytes += 64;263data += 64;264}265if (end > data) {266// Fill the buffer with what remains.267memcpy(buf + bufsize, data, end - data);268bytes += end - data;269}270return *this;271}273void CRIPEMD160::Finalize(unsigned char hash[OUTPUT_SIZE])274{275static const unsigned char pad[64] = {0x80};276unsigned char sizedesc[8];277WriteLE64(sizedesc, bytes << 3);278Write(pad, 1 + ((119 - (bytes % 64)) % 64));279Write(sizedesc, 8);280WriteLE32(hash, s[0]);281WriteLE32(hash + 4, s[1]);282WriteLE32(hash + 8, s[2]);283WriteLE32(hash + 12, s[3]);284WriteLE32(hash + 16, s[4]);285}287CRIPEMD160& CRIPEMD160::Reset()288{289bytes = 0;290ripemd160::Initialize(s);291return *this;292}
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.