MCPcopy Create free account
hub / github.com/andrivet/ADVobfuscator / test_aes_ctr_cipher

Function test_aes_ctr_cipher

tests/main.cpp:322–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322void test_aes_ctr_cipher() {
323 static constexpr Byte input[] = {0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d, 0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34, 0x69, 0x65, 0xfa, 0x98, 0x18, 0xad, 0x58};
324 static constexpr Key key = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c};
325 static constexpr Nonce nonce = {0xb2, 0x96, 0x75, 0x8f, 0x1b, 0x06, 0x5d, 0x3e};
326
327 auto encrypted = encrypt_ctr(input, key, nonce);
328 decrypt_ctr(encrypted.data(), encrypted.size(), key, nonce);
329
330 auto decrypted = encrypted.data();
331 assert(decrypted[ 0] == input[ 0]); assert(decrypted[ 1] == input[ 1]); assert(decrypted[ 2] == input[ 2]); assert(decrypted[ 3] == input[ 3]);
332 assert(decrypted[ 4] == input[ 4]); assert(decrypted[ 5] == input[ 5]); assert(decrypted[ 6] == input[ 6]); assert(decrypted[ 7] == input[ 7]);
333 assert(decrypted[ 8] == input[ 8]); assert(decrypted[ 9] == input[ 9]); assert(decrypted[10] == input[10]); assert(decrypted[11] == input[11]);
334 assert(decrypted[12] == input[12]); assert(decrypted[13] == input[13]); assert(decrypted[14] == input[14]); assert(decrypted[15] == input[15]);
335 assert(decrypted[16] == input[16]); assert(decrypted[17] == input[17]); assert(decrypted[18] == input[18]); assert(decrypted[19] == input[19]);
336 assert(decrypted[20] == input[20]); assert(decrypted[21] == input[21]); assert(decrypted[22] == input[22]);
337}
338
339
340int main() {

Callers 1

mainFunction · 0.85

Calls 4

encrypt_ctrFunction · 0.85
decrypt_ctrFunction · 0.85
dataMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected