mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-06 11:13:02 +02:00
Merge #19326: Simplify hash.h interface using Spans
77c507358bMake Hash[160] consume range-like objects (Pieter Wuille)02c4cc5c5dMake CHash256/CHash160 output to Span (Pieter Wuille)0ef97b1b10Make MurmurHash3 consume Spans (Pieter Wuille)e549bf8a9aMake CHash256 and CHash160 consume Spans (Pieter Wuille)2a2182c387Make script/standard's BaseHash Span-convertible (Pieter Wuille)e63dcc3a67Add MakeUCharSpan, to help constructing Span<[const] unsigned char> (Pieter Wuille)567825049fMake uint256 Span-convertible by adding ::data() (Pieter Wuille)131a2f0337scripted-diff: rename base_blob::data to m_data (Pieter Wuille) Pull request description: This makes use of the implicit constructions and conversions to Span introduced in #18468 to simplify the hash.h interface: * All functions that take a pointer and a length are changed to take a Span instead. * The Hash() and Hash160() functions are changed to take in "range" objects instead of begin/end iterators. ACKs for top commit: laanwj: re-ACK77c507358bjonatack: Code review re-ACK77c5073per `git range-diff14ceddd49fc016 77c5073` Tree-SHA512: 9ec929891b1ddcf30eb14b946ee1bf142eca1442b9de0067ad6a3c181e0c7ea0c99c0e291e7f6e7a18bd7bdf78fe94ee3d5de66e167401674caf91e026269771
This commit is contained in:
@@ -44,8 +44,8 @@ void test_one_input(const std::vector<uint8_t>& buffer)
|
||||
}
|
||||
}
|
||||
|
||||
(void)hash160.Write(data.data(), data.size());
|
||||
(void)hash256.Write(data.data(), data.size());
|
||||
(void)hash160.Write(data);
|
||||
(void)hash256.Write(data);
|
||||
(void)hmac_sha256.Write(data.data(), data.size());
|
||||
(void)hmac_sha512.Write(data.data(), data.size());
|
||||
(void)ripemd160.Write(data.data(), data.size());
|
||||
@@ -54,9 +54,8 @@ void test_one_input(const std::vector<uint8_t>& buffer)
|
||||
(void)sha512.Write(data.data(), data.size());
|
||||
(void)sip_hasher.Write(data.data(), data.size());
|
||||
|
||||
(void)Hash(data.begin(), data.end());
|
||||
(void)Hash(data);
|
||||
(void)Hash160(data);
|
||||
(void)Hash160(data.begin(), data.end());
|
||||
(void)sha512.Size();
|
||||
break;
|
||||
}
|
||||
@@ -73,12 +72,12 @@ void test_one_input(const std::vector<uint8_t>& buffer)
|
||||
switch (fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 8)) {
|
||||
case 0: {
|
||||
data.resize(CHash160::OUTPUT_SIZE);
|
||||
hash160.Finalize(data.data());
|
||||
hash160.Finalize(data);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
data.resize(CHash256::OUTPUT_SIZE);
|
||||
hash256.Finalize(data.data());
|
||||
hash256.Finalize(data);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
|
||||
@@ -85,7 +85,7 @@ void test_one_input(const std::vector<uint8_t>& buffer)
|
||||
assert(negated_key == key);
|
||||
}
|
||||
|
||||
const uint256 random_uint256 = Hash(buffer.begin(), buffer.end());
|
||||
const uint256 random_uint256 = Hash(buffer);
|
||||
|
||||
{
|
||||
CKey child_key;
|
||||
|
||||
Reference in New Issue
Block a user