MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / TestAES256

Method TestAES256

src/test/crypto_tests.cpp:79–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79void TestAES256(const std::string &hexkey, const std::string &hexin, const std::string &hexout)
80{
81 std::vector<unsigned char> key = ParseHex(hexkey);
82 std::vector<unsigned char> in = ParseHex(hexin);
83 std::vector<unsigned char> correctout = ParseHex(hexout);
84 std::vector<unsigned char> buf;
85
86 assert(key.size() == 32);
87 assert(in.size() == 16);
88 assert(correctout.size() == 16);
89 AES256Encrypt enc(key.data());
90 buf.resize(correctout.size());
91 enc.Encrypt(buf.data(), in.data());
92 BOOST_CHECK(buf == correctout);
93 AES256Decrypt dec(key.data());
94 dec.Decrypt(buf.data(), buf.data());
95 BOOST_CHECK(buf == in);
96}
97
98void TestAES256CBC(const std::string &hexkey, const std::string &hexiv, bool pad, const std::string &hexin, const std::string &hexout)
99{

Callers

nothing calls this directly

Calls 6

ParseHexFunction · 0.85
sizeMethod · 0.45
dataMethod · 0.45
resizeMethod · 0.45
EncryptMethod · 0.45
DecryptMethod · 0.45

Tested by

no test coverage detected