-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
30 lines (25 loc) · 1.06 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (C) 2022 Valentin-Ioan VINTILA.
// All rights reserved.
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
#include "include/wi-aes.hpp"
int main() {
wi::AESEngine engine(192);
unsigned char in[128] = "The Cake Is A Lie", enc[1024]{}, dec[1024]{};
unsigned char key[64] = "abcdefghijklmnopqrstuvwx", iv[64] = "0123456789ABCDEF";
const uint32_t inSize = 17;
cout << "--------------------" << endl;
cout << "Unencrypted message: " << wi::uc_to_hex_string(in, inSize) << endl;
cout << "--------------------" << endl;
const uint32_t encLength = engine.encrypt_CTR(key, in, inSize, enc, iv);
cout << " Encryption length: " << encLength << endl;
cout << " Encrypted message: " << wi::uc_to_hex_string(enc, encLength) << endl;
cout << "--------------------" << endl;
const uint32_t decLength = engine.decrypt_CTR(key, enc, encLength, dec, iv);
cout << " Decryption length: " << decLength << endl;
cout << " Decrypted message: " << wi::uc_to_hex_string(dec, decLength) << endl;
cout << "--------------------" << endl;
return 0;
}