MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / TestAES128

Function TestAES128

src/test/crypto_tests.cpp:69–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69static void TestAES128(const std::string &hexkey, const std::string &hexin, const std::string &hexout)
70{
71 std::vector<unsigned char> key = ParseHex(hexkey);
72 std::vector<unsigned char> in = ParseHex(hexin);
73 std::vector<unsigned char> correctout = ParseHex(hexout);
74 std::vector<unsigned char> buf, buf2;
75
76 assert(key.size() == 16);
77 assert(in.size() == 16);
78 assert(correctout.size() == 16);
79 AES128Encrypt enc(key.data());
80 buf.resize(correctout.size());
81 buf2.resize(correctout.size());
82 enc.Encrypt(buf.data(), in.data());
83 BOOST_CHECK_EQUAL(HexStr(buf), HexStr(correctout));
84 AES128Decrypt dec(key.data());
85 dec.Decrypt(buf2.data(), buf.data());
86 BOOST_CHECK_EQUAL(HexStr(buf2), HexStr(in));
87}
88
89static void TestAES256(const std::string &hexkey, const std::string &hexin, const std::string &hexout)
90{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 7

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

Tested by

no test coverage detected