mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-05 10:42:13 +02:00
Make CHash256/CHash160 output to Span
This commit is contained in:
@@ -743,7 +743,7 @@ BOOST_AUTO_TEST_CASE(sha256d64)
|
||||
in[j] = InsecureRandBits(8);
|
||||
}
|
||||
for (int j = 0; j < i; ++j) {
|
||||
CHash256().Write({in + 64 * j, 64}).Finalize(out1 + 32 * j);
|
||||
CHash256().Write({in + 64 * j, 64}).Finalize({out1 + 32 * j, 32});
|
||||
}
|
||||
SHA256D64(out2, in, i);
|
||||
BOOST_CHECK(memcmp(out1, out2, 32 * i) == 0);
|
||||
|
||||
@@ -73,12 +73,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: {
|
||||
|
||||
@@ -196,7 +196,7 @@ BOOST_AUTO_TEST_CASE(key_key_negation)
|
||||
std::string str = "Bitcoin key verification\n";
|
||||
GetRandBytes(rnd, sizeof(rnd));
|
||||
uint256 hash;
|
||||
CHash256().Write(MakeUCharSpan(str)).Write(rnd).Finalize(hash.begin());
|
||||
CHash256().Write(MakeUCharSpan(str)).Write(rnd).Finalize(hash);
|
||||
|
||||
// import the static test key
|
||||
CKey key = DecodeSecret(strSecret1C);
|
||||
|
||||
@@ -60,7 +60,7 @@ static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot
|
||||
}
|
||||
}
|
||||
mutated |= (inner[level] == h);
|
||||
CHash256().Write(inner[level]).Write(h).Finalize(h.begin());
|
||||
CHash256().Write(inner[level]).Write(h).Finalize(h);
|
||||
}
|
||||
// Store the resulting hash at inner position level.
|
||||
inner[level] = h;
|
||||
@@ -86,7 +86,7 @@ static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot
|
||||
if (pbranch && matchh) {
|
||||
pbranch->push_back(h);
|
||||
}
|
||||
CHash256().Write(h).Write(h).Finalize(h.begin());
|
||||
CHash256().Write(h).Write(h).Finalize(h);
|
||||
// Increment count to the value it would have if two entries at this
|
||||
// level had existed.
|
||||
count += (((uint32_t)1) << level);
|
||||
@@ -101,7 +101,7 @@ static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot
|
||||
matchh = true;
|
||||
}
|
||||
}
|
||||
CHash256().Write(inner[level]).Write(h).Finalize(h.begin());
|
||||
CHash256().Write(inner[level]).Write(h).Finalize(h);
|
||||
level++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestination)
|
||||
s << OP_0 << ToByteVector(pubkey.GetID());
|
||||
BOOST_CHECK(ExtractDestination(s, address));
|
||||
WitnessV0KeyHash keyhash;
|
||||
CHash160().Write(pubkey).Finalize(keyhash.begin());
|
||||
CHash160().Write(pubkey).Finalize(keyhash);
|
||||
BOOST_CHECK(boost::get<WitnessV0KeyHash>(&address) && *boost::get<WitnessV0KeyHash>(&address) == keyhash);
|
||||
|
||||
// TxoutType::WITNESS_V0_SCRIPTHASH
|
||||
|
||||
@@ -282,7 +282,7 @@ public:
|
||||
CScript scriptPubKey = script;
|
||||
if (wm == WitnessMode::PKH) {
|
||||
uint160 hash;
|
||||
CHash160().Write(MakeSpan(script).subspan(1)).Finalize(hash.begin());
|
||||
CHash160().Write(MakeSpan(script).subspan(1)).Finalize(hash);
|
||||
script = CScript() << OP_DUP << OP_HASH160 << ToByteVector(hash) << OP_EQUALVERIFY << OP_CHECKSIG;
|
||||
scriptPubKey = CScript() << witnessversion << ToByteVector(hash);
|
||||
} else if (wm == WitnessMode::SH) {
|
||||
|
||||
Reference in New Issue
Block a user