MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / SetKeyFromPassphrase

Method SetKeyFromPassphrase

src/wallet/crypter.cpp:42–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::vector<unsigned char>& chSalt, const unsigned int nRounds, const unsigned int nDerivationMethod)
43{
44 if (nRounds < 1 || chSalt.size() != WALLET_CRYPTO_SALT_SIZE)
45 return false;
46
47 int i = 0;
48 if (nDerivationMethod == 0)
49 i = BytesToKeySHA512AES(chSalt, strKeyData, nRounds, vchKey.data(), vchIV.data());
50
51 if (i != (int)WALLET_CRYPTO_KEY_SIZE)
52 {
53 memory_cleanse(vchKey.data(), vchKey.size());
54 memory_cleanse(vchIV.data(), vchIV.size());
55 return false;
56 }
57
58 fKeySet = true;
59 return true;
60}
61
62bool CCrypter::SetKey(const CKeyingMaterial& chNewKey, const std::vector<unsigned char>& chNewIV)
63{

Callers 5

UnlockMethod · 0.80
EncryptWalletMethod · 0.80
TestPassphraseSingleMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 3

memory_cleanseFunction · 0.85
sizeMethod · 0.45
dataMethod · 0.45

Tested by 2

TestPassphraseSingleMethod · 0.64
BOOST_AUTO_TEST_CASEFunction · 0.64