mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
refactor: use Span in random.*
This commit is contained in:
@@ -159,7 +159,7 @@ bool CKey::Check(const unsigned char *vch) {
|
||||
|
||||
void CKey::MakeNewKey(bool fCompressedIn) {
|
||||
do {
|
||||
GetStrongRandBytes(keydata.data(), keydata.size());
|
||||
GetStrongRandBytes(keydata);
|
||||
} while (!Check(keydata.data()));
|
||||
fValid = true;
|
||||
fCompressed = fCompressedIn;
|
||||
@@ -244,7 +244,7 @@ bool CKey::VerifyPubKey(const CPubKey& pubkey) const {
|
||||
}
|
||||
unsigned char rnd[8];
|
||||
std::string str = "Bitcoin key verification\n";
|
||||
GetRandBytes(rnd, sizeof(rnd));
|
||||
GetRandBytes(rnd);
|
||||
uint256 hash;
|
||||
CHash256().Write(MakeUCharSpan(str)).Write(rnd).Finalize(hash);
|
||||
std::vector<unsigned char> vchSig;
|
||||
@@ -397,7 +397,7 @@ void ECC_Start() {
|
||||
{
|
||||
// Pass in a random blinding seed to the secp256k1 context.
|
||||
std::vector<unsigned char, secure_allocator<unsigned char>> vseed(32);
|
||||
GetRandBytes(vseed.data(), 32);
|
||||
GetRandBytes(vseed);
|
||||
bool ret = secp256k1_context_randomize(ctx, vseed.data());
|
||||
assert(ret);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user