-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
31 lines (28 loc) · 694 Bytes
/
Copy pathmain.cpp
File metadata and controls
31 lines (28 loc) · 694 Bytes
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
31
#include<iostream>
#include "aes.h"
#include "aes_128_ecb.h"
#include "aes_128_cbc.h"
#include "aes_128_cfb.h"
#include "aes_128_ofb.h"
#include "aes_128_ctr.h"
#include<string>
void read_key(FILE* file, byte key[16]){
for(int i = 0; i < 16; ++i){
fscanf(file, "%2hhx", key + i);
}
}
int main() {
byte iv[16] = { 0x36,0xf1,0x83,0x57,0xbe,0x4d,0xbd,0x77,0xf0,0x50,0x51,0x5c,0x73,0xfc,0xf9,0xf2 };
byte key[16];
FILE* in = fopen("./in", "r");
FILE* out = fopen("./out", "w");
FILE* key_f = fopen("./key", "r");
read_key(key_f, key);
fclose(key_f);
//aes_128_ecb temp(in, out, key);
aes_128_cbc temp(in, out, key, iv, bin);
temp.decrypt();
fclose(in);
fclose(out);
return 0;
}