Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/wallet_crypto_tests.cpp
Show All 14 Lines | |||||
class TestCrypter { | class TestCrypter { | ||||
public: | public: | ||||
static void TestPassphraseSingle( | static void TestPassphraseSingle( | ||||
const std::vector<uint8_t> &vchSalt, const SecureString &passphrase, | const std::vector<uint8_t> &vchSalt, const SecureString &passphrase, | ||||
uint32_t rounds, | uint32_t rounds, | ||||
const std::vector<uint8_t> &correctKey = std::vector<uint8_t>(), | const std::vector<uint8_t> &correctKey = std::vector<uint8_t>(), | ||||
const std::vector<uint8_t> &correctIV = std::vector<uint8_t>()) { | const std::vector<uint8_t> &correctIV = std::vector<uint8_t>()) { | ||||
CCrypter crypt; | CCrypter crypt; | ||||
crypt.SetKeyFromPassphrase(passphrase, vchSalt, rounds, 0); | crypt.SetKeyFromPassphrase(passphrase, vchSalt, rounds, 0); | ||||
if (!correctKey.empty()) { | if (!correctKey.empty()) { | ||||
BOOST_CHECK_MESSAGE( | BOOST_CHECK_MESSAGE( | ||||
memcmp(crypt.vchKey.data(), correctKey.data(), | memcmp(crypt.vchKey.data(), correctKey.data(), | ||||
crypt.vchKey.size()) == 0, | crypt.vchKey.size()) == 0, | ||||
HexStr(crypt.vchKey.begin(), crypt.vchKey.end()) + | HexStr(crypt.vchKey.begin(), crypt.vchKey.end()) + | ||||
▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines |