MCPcopy Create free account
hub / github.com/ElementsProject/elements / TestAES256

Function TestAES256

src/test/crypto_tests.cpp:73–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

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