diff options
| author | Benedict <benedict@0xb8000.de> | 2017-02-02 00:32:26 +0100 |
|---|---|---|
| committer | Benedict <benedict@0xb8000.de> | 2017-02-21 13:00:27 +0100 |
| commit | 1fd84c7dc70a0a6e6d8651fafa50c51dd697ae77 (patch) | |
| tree | af5de3c7952e071c8e27800c41d9f945fa86c9e7 /set3/task19.c | |
| parent | 9dcc7348ad53cab8fd9396699de0177bac6729d5 (diff) | |
added random stuff which hasn't beend added because yeah
Diffstat (limited to 'set3/task19.c')
| -rw-r--r-- | set3/task19.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/set3/task19.c b/set3/task19.c new file mode 100644 index 0000000..a036f4f --- /dev/null +++ b/set3/task19.c @@ -0,0 +1,35 @@ +#include "../lib/lib.h" +#include "../lib/lib2.h" +#include "../lib/lib3.h" +#include <time.h> + +#define CHALLENGE19_FILE_NR 40 +int main() +{ + int i; + char **file = malloc(sizeof(char *)*CHALLENGE19_FILE_NR); + int length_file[CHALLENGE19_FILE_NR]; + int length[CHALLENGE19_FILE_NR]; + char **plaintext= malloc(sizeof(char *)*CHALLENGE19_FILE_NR); + char **ciphertext= malloc(sizeof(char *)*CHALLENGE19_FILE_NR); + char filename[] = "./task19_data/task19_00"; + + char nonce[16]; + generate_random_bytes(key, 16); + generate_random_bytes(nonce, 16); + + for(i=0;i<CHALLENGE19_FILE_NR;i++) { + filename[strlen(filename)-1] = ((i % 10)+ '0'); + filename[strlen(filename)-2] = ((i / 10) + '0'); + length_file[i] = read_base64_file(filename, &file[i]); + plaintext[i] = malloc(length_file[i]); + length[i] = decode_base64(file[i], plaintext[i]); + printf("%s\n", plaintext[i]); + ciphertext[i] = malloc(length[i]); + aes_ctr(plaintext[i], length[i], ciphertext[i], key, nonce); + } + + // let the cracking begin + + +} |
