MCPcopy Create free account
hub / github.com/ElementsProject/elements / CHash160

Class CHash160

src/hash.h:49–71  ·  view source on GitHub ↗

A hasher class for Bitcoin's 160-bit hash (SHA-256 + RIPEMD-160). */

Source from the content-addressed store, hash-verified

47
48/** A hasher class for Bitcoin's 160-bit hash (SHA-256 + RIPEMD-160). */
49class CHash160 {
50private:
51 CSHA256 sha;
52public:
53 static const size_t OUTPUT_SIZE = CRIPEMD160::OUTPUT_SIZE;
54
55 void Finalize(Span<unsigned char> output) {
56 assert(output.size() == OUTPUT_SIZE);
57 unsigned char buf[CSHA256::OUTPUT_SIZE];
58 sha.Finalize(buf);
59 CRIPEMD160().Write(buf, CSHA256::OUTPUT_SIZE).Finalize(output.data());
60 }
61
62 CHash160& Write(Span<const unsigned char> input) {
63 sha.Write(input.data(), input.size());
64 return *this;
65 }
66
67 CHash160& Reset() {
68 sha.Reset();
69 return *this;
70 }
71};
72
73/** Compute the 256-bit hash of an object. */
74template<typename T>

Callers 6

Hash160Function · 0.85
EvalScriptFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
TestBuilderMethod · 0.85
ScriptHasValidPAKProofFunction · 0.85
VerifyScriptBenchFunction · 0.85

Calls 4

WriteMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
ResetMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.68
TestBuilderMethod · 0.68