mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
refactor: Replace &foo[0] with foo.data()
This commit is contained in:
parent
faece47c47
commit
fac30eec42
15 changed files with 40 additions and 40 deletions
|
@ -45,7 +45,7 @@ int main()
|
|||
stream << vanillaSpendTx;
|
||||
|
||||
bitcoinconsensus_error err;
|
||||
auto op0Result = bitcoinconsensus_verify_script_with_amount(pubKeyScript.data(), pubKeyScript.size(), amount, (const unsigned char*)&stream[0], stream.size(), 0, bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL, &err);
|
||||
auto op0Result = bitcoinconsensus_verify_script_with_amount(pubKeyScript.data(), pubKeyScript.size(), amount, stream.data(), stream.size(), 0, bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL, &err);
|
||||
std::cout << "Op0 result: " << op0Result << ", error code " << err << std::endl;
|
||||
|
||||
getchar();
|
||||
|
|
|
@ -248,7 +248,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
|
|||
|
||||
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ssTx << *newTx;
|
||||
transaction_array.append((const char*)&(ssTx[0]), ssTx.size());
|
||||
transaction_array.append((const char*)ssTx.data(), ssTx.size());
|
||||
}
|
||||
|
||||
// Add addresses / update labels that we've sent to the address book,
|
||||
|
|
|
@ -628,7 +628,7 @@ std::vector<unsigned char> FastRandomContext::randbytes(size_t len)
|
|||
if (requires_seed) RandomSeed();
|
||||
std::vector<unsigned char> ret(len);
|
||||
if (len > 0) {
|
||||
rng.Keystream(&ret[0], len);
|
||||
rng.Keystream(ret.data(), len);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1890,7 +1890,7 @@ static bool VerifyWitnessProgram(const CScriptWitness& witness, int witversion,
|
|||
const valtype& script_bytes = SpanPopBack(stack);
|
||||
exec_script = CScript(script_bytes.begin(), script_bytes.end());
|
||||
uint256 hash_exec_script;
|
||||
CSHA256().Write(&exec_script[0], exec_script.size()).Finalize(hash_exec_script.begin());
|
||||
CSHA256().Write(exec_script.data(), exec_script.size()).Finalize(hash_exec_script.begin());
|
||||
if (memcmp(hash_exec_script.begin(), program.data(), 32)) {
|
||||
return set_error(serror, SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH);
|
||||
}
|
||||
|
|
|
@ -53,14 +53,14 @@ public:
|
|||
ComputeEntryECDSA(uint256& entry, const uint256 &hash, const std::vector<unsigned char>& vchSig, const CPubKey& pubkey) const
|
||||
{
|
||||
CSHA256 hasher = m_salted_hasher_ecdsa;
|
||||
hasher.Write(hash.begin(), 32).Write(&pubkey[0], pubkey.size()).Write(vchSig.data(), vchSig.size()).Finalize(entry.begin());
|
||||
hasher.Write(hash.begin(), 32).Write(pubkey.data(), pubkey.size()).Write(vchSig.data(), vchSig.size()).Finalize(entry.begin());
|
||||
}
|
||||
|
||||
void
|
||||
ComputeEntrySchnorr(uint256& entry, const uint256 &hash, Span<const unsigned char> sig, const XOnlyPubKey& pubkey) const
|
||||
{
|
||||
CSHA256 hasher = m_salted_hasher_schnorr;
|
||||
hasher.Write(hash.begin(), 32).Write(&pubkey[0], pubkey.size()).Write(sig.data(), sig.size()).Finalize(entry.begin());
|
||||
hasher.Write(hash.begin(), 32).Write(pubkey.data(), pubkey.size()).Write(sig.data(), sig.size()).Finalize(entry.begin());
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -167,7 +167,7 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator
|
|||
return true;
|
||||
|
||||
case TxoutType::WITNESS_V0_SCRIPTHASH:
|
||||
CRIPEMD160().Write(&vSolutions[0][0], vSolutions[0].size()).Finalize(h160.begin());
|
||||
CRIPEMD160().Write(vSolutions[0].data(), vSolutions[0].size()).Finalize(h160.begin());
|
||||
if (GetCScript(provider, sigdata, CScriptID{h160}, scriptRet)) {
|
||||
ret.push_back(std::vector<unsigned char>(scriptRet.begin(), scriptRet.end()));
|
||||
return true;
|
||||
|
|
|
@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(compress_script_to_ckey_id)
|
|||
// Check compressed script
|
||||
BOOST_CHECK_EQUAL(out.size(), 21U);
|
||||
BOOST_CHECK_EQUAL(out[0], 0x00);
|
||||
BOOST_CHECK_EQUAL(memcmp(&out[1], &script[3], 20), 0); // compare the 20 relevant chars of the CKeyId in the script
|
||||
BOOST_CHECK_EQUAL(memcmp(out.data() + 1, script.data() + 3, 20), 0); // compare the 20 relevant chars of the CKeyId in the script
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(compress_script_to_cscript_id)
|
||||
|
@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(compress_script_to_cscript_id)
|
|||
// Check compressed script
|
||||
BOOST_CHECK_EQUAL(out.size(), 21U);
|
||||
BOOST_CHECK_EQUAL(out[0], 0x01);
|
||||
BOOST_CHECK_EQUAL(memcmp(&out[1], &script[2], 20), 0); // compare the 20 relevant chars of the CScriptId in the script
|
||||
BOOST_CHECK_EQUAL(memcmp(out.data() + 1, script.data() + 2, 20), 0); // compare the 20 relevant chars of the CScriptId in the script
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(compress_script_to_compressed_pubkey_id)
|
||||
|
@ -113,8 +113,8 @@ BOOST_AUTO_TEST_CASE(compress_script_to_compressed_pubkey_id)
|
|||
|
||||
// Check compressed script
|
||||
BOOST_CHECK_EQUAL(out.size(), 33U);
|
||||
BOOST_CHECK_EQUAL(memcmp(&out[0], &script[1], 1), 0);
|
||||
BOOST_CHECK_EQUAL(memcmp(&out[1], &script[2], 32), 0); // compare the 32 chars of the compressed CPubKey
|
||||
BOOST_CHECK_EQUAL(memcmp(out.data(), script.data() + 1, 1), 0);
|
||||
BOOST_CHECK_EQUAL(memcmp(out.data() + 1, script.data() + 2, 32), 0); // compare the 32 chars of the compressed CPubKey
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(compress_script_to_uncompressed_pubkey_id)
|
||||
|
@ -130,7 +130,7 @@ BOOST_AUTO_TEST_CASE(compress_script_to_uncompressed_pubkey_id)
|
|||
|
||||
// Check compressed script
|
||||
BOOST_CHECK_EQUAL(out.size(), 33U);
|
||||
BOOST_CHECK_EQUAL(memcmp(&out[1], &script[2], 32), 0); // first 32 chars of CPubKey are copied into out[1:]
|
||||
BOOST_CHECK_EQUAL(memcmp(out.data() + 1, script.data() + 2, 32), 0); // first 32 chars of CPubKey are copied into out[1:]
|
||||
BOOST_CHECK_EQUAL(out[0], 0x04 | (script[65] & 0x01)); // least significant bit (lsb) of last char of pubkey is mapped into out[0]
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ static void TestVector(const Hasher &h, const In &in, const Out &out) {
|
|||
hash.resize(out.size());
|
||||
{
|
||||
// Test that writing the whole input string at once works.
|
||||
Hasher(h).Write((unsigned char*)&in[0], in.size()).Finalize(&hash[0]);
|
||||
Hasher(h).Write((const uint8_t*)in.data(), in.size()).Finalize(hash.data());
|
||||
BOOST_CHECK(hash == out);
|
||||
}
|
||||
for (int i=0; i<32; i++) {
|
||||
|
@ -42,15 +42,15 @@ static void TestVector(const Hasher &h, const In &in, const Out &out) {
|
|||
size_t pos = 0;
|
||||
while (pos < in.size()) {
|
||||
size_t len = InsecureRandRange((in.size() - pos + 1) / 2 + 1);
|
||||
hasher.Write((unsigned char*)&in[pos], len);
|
||||
hasher.Write((const uint8_t*)in.data() + pos, len);
|
||||
pos += len;
|
||||
if (pos > 0 && pos + 2 * out.size() > in.size() && pos < in.size()) {
|
||||
// Test that writing the rest at once to a copy of a hasher works.
|
||||
Hasher(hasher).Write((unsigned char*)&in[pos], in.size() - pos).Finalize(&hash[0]);
|
||||
Hasher(hasher).Write((const uint8_t*)in.data() + pos, in.size() - pos).Finalize(hash.data());
|
||||
BOOST_CHECK(hash == out);
|
||||
}
|
||||
}
|
||||
hasher.Finalize(&hash[0]);
|
||||
hasher.Finalize(hash.data());
|
||||
BOOST_CHECK(hash == out);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ CScript ConsumeScript(FuzzedDataProvider& fuzzed_data_provider, const size_t max
|
|||
CScript r_script{b.begin(), b.end()};
|
||||
if (maybe_p2wsh && fuzzed_data_provider.ConsumeBool()) {
|
||||
uint256 script_hash;
|
||||
CSHA256().Write(&r_script[0], r_script.size()).Finalize(script_hash.begin());
|
||||
CSHA256().Write(r_script.data(), r_script.size()).Finalize(script_hash.begin());
|
||||
r_script.clear();
|
||||
r_script << OP_0 << ToByteVector(script_hash);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(script_standard_Solver_success)
|
|||
|
||||
// TxoutType::WITNESS_V0_SCRIPTHASH
|
||||
uint256 scriptHash;
|
||||
CSHA256().Write(&redeemScript[0], redeemScript.size())
|
||||
CSHA256().Write(redeemScript.data(), redeemScript.size())
|
||||
.Finalize(scriptHash.begin());
|
||||
|
||||
s.clear();
|
||||
|
@ -370,7 +370,7 @@ BOOST_AUTO_TEST_CASE(script_standard_GetScriptFor_)
|
|||
witnessScript << OP_1 << ToByteVector(pubkeys[0]) << OP_1 << OP_CHECKMULTISIG;
|
||||
|
||||
uint256 scriptHash;
|
||||
CSHA256().Write(&witnessScript[0], witnessScript.size())
|
||||
CSHA256().Write(witnessScript.data(), witnessScript.size())
|
||||
.Finalize(scriptHash.begin());
|
||||
|
||||
expected.clear();
|
||||
|
|
|
@ -155,10 +155,10 @@ void DoTest(const CScript& scriptPubKey, const CScript& scriptSig, const CScript
|
|||
if (libconsensus_flags == flags) {
|
||||
int expectedSuccessCode = expect ? 1 : 0;
|
||||
if (flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS) {
|
||||
BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script_with_amount(scriptPubKey.data(), scriptPubKey.size(), txCredit.vout[0].nValue, (const unsigned char*)&stream[0], stream.size(), 0, libconsensus_flags, nullptr) == expectedSuccessCode, message);
|
||||
BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script_with_amount(scriptPubKey.data(), scriptPubKey.size(), txCredit.vout[0].nValue, stream.data(), stream.size(), 0, libconsensus_flags, nullptr) == expectedSuccessCode, message);
|
||||
} else {
|
||||
BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script_with_amount(scriptPubKey.data(), scriptPubKey.size(), 0, (const unsigned char*)&stream[0], stream.size(), 0, libconsensus_flags, nullptr) == expectedSuccessCode, message);
|
||||
BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), 0, libconsensus_flags, nullptr) == expectedSuccessCode, message);
|
||||
BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script_with_amount(scriptPubKey.data(), scriptPubKey.size(), 0, stream.data(), stream.size(), 0, libconsensus_flags, nullptr) == expectedSuccessCode, message);
|
||||
BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), stream.data(), stream.size(), 0, libconsensus_flags, nullptr) == expectedSuccessCode, message);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -224,7 +224,7 @@ struct KeyData
|
|||
pubkey0 = key0.GetPubKey();
|
||||
pubkey0H = key0.GetPubKey();
|
||||
pubkey0C = key0C.GetPubKey();
|
||||
*const_cast<unsigned char*>(&pubkey0H[0]) = 0x06 | (pubkey0H[64] & 1);
|
||||
*const_cast<unsigned char*>(pubkey0H.data()) = 0x06 | (pubkey0H[64] & 1);
|
||||
|
||||
key1.Set(vchKey1, vchKey1 + 32, false);
|
||||
key1C.Set(vchKey1, vchKey1 + 32, true);
|
||||
|
@ -290,7 +290,7 @@ public:
|
|||
} else if (wm == WitnessMode::SH) {
|
||||
witscript = scriptPubKey;
|
||||
uint256 hash;
|
||||
CSHA256().Write(&witscript[0], witscript.size()).Finalize(hash.begin());
|
||||
CSHA256().Write(witscript.data(), witscript.size()).Finalize(hash.begin());
|
||||
scriptPubKey = CScript() << witnessversion << ToByteVector(hash);
|
||||
}
|
||||
if (P2SH) {
|
||||
|
@ -774,7 +774,7 @@ BOOST_AUTO_TEST_CASE(script_build)
|
|||
{
|
||||
CScript witscript = CScript() << ToByteVector(keys.pubkey0);
|
||||
uint256 hash;
|
||||
CSHA256().Write(&witscript[0], witscript.size()).Finalize(hash.begin());
|
||||
CSHA256().Write(witscript.data(), witscript.size()).Finalize(hash.begin());
|
||||
std::vector<unsigned char> hashBytes = ToByteVector(hash);
|
||||
hashBytes.pop_back();
|
||||
tests.push_back(TestBuilder(CScript() << OP_0 << hashBytes,
|
||||
|
@ -1520,7 +1520,7 @@ BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_returns_true)
|
|||
stream << spendTx;
|
||||
|
||||
bitcoinconsensus_error err;
|
||||
int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), nIn, libconsensus_flags, &err);
|
||||
int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), stream.data(), stream.size(), nIn, libconsensus_flags, &err);
|
||||
BOOST_CHECK_EQUAL(result, 1);
|
||||
BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_OK);
|
||||
}
|
||||
|
@ -1543,7 +1543,7 @@ BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_tx_index_err)
|
|||
stream << spendTx;
|
||||
|
||||
bitcoinconsensus_error err;
|
||||
int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), nIn, libconsensus_flags, &err);
|
||||
int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), stream.data(), stream.size(), nIn, libconsensus_flags, &err);
|
||||
BOOST_CHECK_EQUAL(result, 0);
|
||||
BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_TX_INDEX);
|
||||
}
|
||||
|
@ -1566,7 +1566,7 @@ BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_tx_size)
|
|||
stream << spendTx;
|
||||
|
||||
bitcoinconsensus_error err;
|
||||
int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size() * 2, nIn, libconsensus_flags, &err);
|
||||
int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), stream.data(), stream.size() * 2, nIn, libconsensus_flags, &err);
|
||||
BOOST_CHECK_EQUAL(result, 0);
|
||||
BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_TX_SIZE_MISMATCH);
|
||||
}
|
||||
|
@ -1589,7 +1589,7 @@ BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_tx_serialization)
|
|||
stream << 0xffffffff;
|
||||
|
||||
bitcoinconsensus_error err;
|
||||
int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), nIn, libconsensus_flags, &err);
|
||||
int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), stream.data(), stream.size(), nIn, libconsensus_flags, &err);
|
||||
BOOST_CHECK_EQUAL(result, 0);
|
||||
BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_TX_DESERIALIZE);
|
||||
}
|
||||
|
@ -1612,7 +1612,7 @@ BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_amount_required_err)
|
|||
stream << spendTx;
|
||||
|
||||
bitcoinconsensus_error err;
|
||||
int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), nIn, libconsensus_flags, &err);
|
||||
int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), stream.data(), stream.size(), nIn, libconsensus_flags, &err);
|
||||
BOOST_CHECK_EQUAL(result, 0);
|
||||
BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_AMOUNT_REQUIRED);
|
||||
}
|
||||
|
@ -1635,7 +1635,7 @@ BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_invalid_flags)
|
|||
stream << spendTx;
|
||||
|
||||
bitcoinconsensus_error err;
|
||||
int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), nIn, libconsensus_flags, &err);
|
||||
int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), stream.data(), stream.size(), nIn, libconsensus_flags, &err);
|
||||
BOOST_CHECK_EQUAL(result, 0);
|
||||
BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_INVALID_FLAGS);
|
||||
}
|
||||
|
@ -1733,7 +1733,7 @@ BOOST_AUTO_TEST_CASE(script_assets_test)
|
|||
size_t length = file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
std::string data(length, '\0');
|
||||
file.read(&data[0], data.size());
|
||||
file.read(data.data(), data.size());
|
||||
UniValue tests = read_json(data);
|
||||
BOOST_CHECK(tests.isArray());
|
||||
BOOST_CHECK(tests.size() > 0);
|
||||
|
|
|
@ -78,7 +78,7 @@ bool CCrypter::Encrypt(const CKeyingMaterial& vchPlaintext, std::vector<unsigned
|
|||
vchCiphertext.resize(vchPlaintext.size() + AES_BLOCKSIZE);
|
||||
|
||||
AES256CBCEncrypt enc(vchKey.data(), vchIV.data(), true);
|
||||
size_t nLen = enc.Encrypt(&vchPlaintext[0], vchPlaintext.size(), vchCiphertext.data());
|
||||
size_t nLen = enc.Encrypt(vchPlaintext.data(), vchPlaintext.size(), vchCiphertext.data());
|
||||
if(nLen < vchPlaintext.size())
|
||||
return false;
|
||||
vchCiphertext.resize(nLen);
|
||||
|
@ -97,7 +97,7 @@ bool CCrypter::Decrypt(const std::vector<unsigned char>& vchCiphertext, CKeyingM
|
|||
vchPlaintext.resize(nLen);
|
||||
|
||||
AES256CBCDecrypt dec(vchKey.data(), vchIV.data(), true);
|
||||
nLen = dec.Decrypt(vchCiphertext.data(), vchCiphertext.size(), &vchPlaintext[0]);
|
||||
nLen = dec.Decrypt(vchCiphertext.data(), vchCiphertext.size(), vchPlaintext.data());
|
||||
if(nLen == 0)
|
||||
return false;
|
||||
vchPlaintext.resize(nLen);
|
||||
|
@ -121,7 +121,7 @@ bool DecryptSecret(const CKeyingMaterial& vMasterKey, const std::vector<unsigned
|
|||
memcpy(chIV.data(), &nIV, WALLET_CRYPTO_IV_SIZE);
|
||||
if(!cKeyCrypter.SetKey(vMasterKey, chIV))
|
||||
return false;
|
||||
return cKeyCrypter.Decrypt(vchCiphertext, *((CKeyingMaterial*)&vchPlaintext));
|
||||
return cKeyCrypter.Decrypt(vchCiphertext, vchPlaintext);
|
||||
}
|
||||
|
||||
bool DecryptKey(const CKeyingMaterial& vMasterKey, const std::vector<unsigned char>& vchCryptedSecret, const CPubKey& vchPubKey, CKey& key)
|
||||
|
|
|
@ -154,8 +154,8 @@ bool RecoverDatabaseFile(const fs::path& file_path, bilingual_str& error, std::v
|
|||
warnings.push_back(strprintf(Untranslated("WARNING: WalletBatch::Recover skipping %s: %s"), strType, strErr));
|
||||
continue;
|
||||
}
|
||||
Dbt datKey(&row.first[0], row.first.size());
|
||||
Dbt datValue(&row.second[0], row.second.size());
|
||||
Dbt datKey(row.first.data(), row.first.size());
|
||||
Dbt datValue(row.second.data(), row.second.size());
|
||||
int ret2 = pdbCopy->put(ptxn, &datKey, &datValue, DB_NOOVERWRITE);
|
||||
if (ret2 > 0)
|
||||
fSuccess = false;
|
||||
|
|
|
@ -162,7 +162,7 @@ IsMineResult IsMineInner(const LegacyScriptPubKeyMan& keystore, const CScript& s
|
|||
break;
|
||||
}
|
||||
uint160 hash;
|
||||
CRIPEMD160().Write(&vSolutions[0][0], vSolutions[0].size()).Finalize(hash.begin());
|
||||
CRIPEMD160().Write(vSolutions[0].data(), vSolutions[0].size()).Finalize(hash.begin());
|
||||
CScriptID scriptID = CScriptID(hash);
|
||||
CScript subscript;
|
||||
if (keystore.GetCScript(scriptID, subscript)) {
|
||||
|
|
|
@ -603,12 +603,12 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
|
|||
CKeyingMaterial _vMasterKey;
|
||||
|
||||
_vMasterKey.resize(WALLET_CRYPTO_KEY_SIZE);
|
||||
GetStrongRandBytes(&_vMasterKey[0], WALLET_CRYPTO_KEY_SIZE);
|
||||
GetStrongRandBytes(_vMasterKey.data(), WALLET_CRYPTO_KEY_SIZE);
|
||||
|
||||
CMasterKey kMasterKey;
|
||||
|
||||
kMasterKey.vchSalt.resize(WALLET_CRYPTO_SALT_SIZE);
|
||||
GetStrongRandBytes(&kMasterKey.vchSalt[0], WALLET_CRYPTO_SALT_SIZE);
|
||||
GetStrongRandBytes(kMasterKey.vchSalt.data(), WALLET_CRYPTO_SALT_SIZE);
|
||||
|
||||
CCrypter crypter;
|
||||
int64_t nStartTime = GetTimeMillis();
|
||||
|
|
Loading…
Reference in a new issue