Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/wallet_crypto_tests.cpp
Show First 20 Lines • Show All 232 Lines • ▼ Show 20 Lines | TestCrypter::TestPassphrase( | ||||
ParseHex("0000deadbeef0000"), "test", 25000, | ParseHex("0000deadbeef0000"), "test", 25000, | ||||
ParseHex( | ParseHex( | ||||
"fc7aba077ad5f4c3a0988d8daa4810d0d4a0e3bcb53af662998898f33df0556a"), | "fc7aba077ad5f4c3a0988d8daa4810d0d4a0e3bcb53af662998898f33df0556a"), | ||||
ParseHex("cf2f2691526dd1aa220896fb8bf7c369")); | ParseHex("cf2f2691526dd1aa220896fb8bf7c369")); | ||||
std::string hash(GetRandHash().ToString()); | std::string hash(GetRandHash().ToString()); | ||||
std::vector<uint8_t> vchSalt(8); | std::vector<uint8_t> vchSalt(8); | ||||
GetRandBytes(&vchSalt[0], vchSalt.size()); | GetRandBytes(&vchSalt[0], vchSalt.size()); | ||||
uint32_t rounds = insecure_rand(); | uint32_t rounds = InsecureRand32(); | ||||
if (rounds > 30000) rounds = 30000; | if (rounds > 30000) rounds = 30000; | ||||
TestCrypter::TestPassphrase(vchSalt, SecureString(hash.begin(), hash.end()), | TestCrypter::TestPassphrase(vchSalt, SecureString(hash.begin(), hash.end()), | ||||
rounds); | rounds); | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(encrypt) { | BOOST_AUTO_TEST_CASE(encrypt) { | ||||
std::vector<uint8_t> vchSalt = ParseHex("0000deadbeef0000"); | std::vector<uint8_t> vchSalt = ParseHex("0000deadbeef0000"); | ||||
BOOST_CHECK(vchSalt.size() == WALLET_CRYPTO_SALT_SIZE); | BOOST_CHECK(vchSalt.size() == WALLET_CRYPTO_SALT_SIZE); | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |