diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2019-01-28 11:57:50 -0800 |
---|---|---|
committer | Ben Woosley <ben.woosley@gmail.com> | 2023-01-26 15:48:49 -0600 |
commit | 6879be691bf636a53208ef058f2ebe18bfa8017c (patch) | |
tree | af66a0818235164158f3100edadeabb1abffbf4d /src/hash.h | |
parent | 7386da7a0b08cd2df8ba88dae1fab9d36424b15c (diff) |
refactor: Extract RIPEMD160
To directly return a CRIPEMD160 hash from data.
Incidentally, decoding this acronym:
* RIPEMD -> RIPE Message Digest
* RIPE -> RACE Integrity Primitives Evaluation
* RACE -> Research and Development in Advanced Communications Technologies in Europe
Diffstat (limited to 'src/hash.h')
-rw-r--r-- | src/hash.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/hash.h b/src/hash.h index b1ff3acc7d..40e809e85e 100644 --- a/src/hash.h +++ b/src/hash.h @@ -11,6 +11,7 @@ #include <crypto/sha256.h> #include <prevector.h> #include <serialize.h> +#include <span.h> #include <uint256.h> #include <version.h> @@ -223,4 +224,12 @@ void BIP32Hash(const ChainCode &chainCode, unsigned int nChild, unsigned char he */ HashWriter TaggedHash(const std::string& tag); +/** Compute the 160-bit RIPEMD-160 hash of an array. */ +inline uint160 RIPEMD160(Span<const unsigned char> data) +{ + uint160 result; + CRIPEMD160().Write(data.data(), data.size()).Finalize(result.begin()); + return result; +} + #endif // BITCOIN_HASH_H |