Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/crypto_tests.cpp
Show First 20 Lines • Show All 208 Lines • ▼ Show 20 Lines | TestEncryptSingle(const CCrypter &crypt, | ||||
if (vchCiphertext1 == vchCiphertext2) | if (vchCiphertext1 == vchCiphertext2) | ||||
TestDecrypt(crypt, vchCiphertext1, vchPlaintext2); | TestDecrypt(crypt, vchCiphertext1, vchPlaintext2); | ||||
} | } | ||||
static void TestEncrypt(const CCrypter &crypt, | static void TestEncrypt(const CCrypter &crypt, | ||||
const std::vector<uint8_t> &vchPlaintextIn, | const std::vector<uint8_t> &vchPlaintextIn, | ||||
const std::vector<uint8_t> &vchCiphertextCorrect = | const std::vector<uint8_t> &vchCiphertextCorrect = | ||||
std::vector<uint8_t>()) { | std::vector<uint8_t>()) { | ||||
TestEncryptSingle(crypt, CKeyingMaterial(vchPlaintextIn.begin(), | TestEncryptSingle( | ||||
vchPlaintextIn.end()), | crypt, | ||||
CKeyingMaterial(vchPlaintextIn.begin(), vchPlaintextIn.end()), | |||||
vchCiphertextCorrect); | vchCiphertextCorrect); | ||||
for (std::vector<uint8_t>::const_iterator i(vchPlaintextIn.begin()); | for (std::vector<uint8_t>::const_iterator i(vchPlaintextIn.begin()); | ||||
i != vchPlaintextIn.end(); ++i) | i != vchPlaintextIn.end(); ++i) | ||||
TestEncryptSingle(crypt, CKeyingMaterial(i, vchPlaintextIn.end())); | TestEncryptSingle(crypt, CKeyingMaterial(i, vchPlaintextIn.end())); | ||||
} | } | ||||
}; | }; | ||||
BOOST_AUTO_TEST_CASE(passphrase) { | BOOST_AUTO_TEST_CASE(passphrase) { | ||||
// These are expensive. | // These are expensive. | ||||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |