From 4ed371cc378a3b579d46ed89a2677769a6d5ea24 Mon Sep 17 00:00:00 2001 From: Benedict Date: Tue, 22 Mar 2016 19:11:22 +0100 Subject: completed set 2 challenge 11 --- set2/Makefile | 2 ++ set2/task10.c | 4 ++- set2/task11.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 set2/task11.c (limited to 'set2') diff --git a/set2/Makefile b/set2/Makefile index 1f8f890..9c5f43e 100644 --- a/set2/Makefile +++ b/set2/Makefile @@ -9,6 +9,8 @@ task9: $(CC) $(CFLAGS) task9.c $(LIB) $(CLIBS) -o task9 task10: $(CC) $(CFLAGS) task10.c $(LIB) $(CLIBS) -o task10 +task11: + $(CC) $(CFLAGS) task11.c $(LIB) $(CLIBS) -o task11 task15: $(CC) $(CFLAGS) task15.c $(LIB) $(CLIBS) -o task15 clean: diff --git a/set2/task10.c b/set2/task10.c index fb8d0c1..19a7235 100644 --- a/set2/task10.c +++ b/set2/task10.c @@ -22,8 +22,10 @@ int main(int argc, char **argv) decoded_content_length = decode_base64(file_content, decoded_content); cleartext = malloc(decoded_content_length+1); // aes cbc - aes_cbc(decoded_content, decoded_content_length, cleartext, string_key, iv); + aes_cbc(decoded_content, decoded_content_length, cleartext, string_key, iv, 0); printf("%s\n", cleartext); + + free(decoded_content); free(cleartext); return 0; diff --git a/set2/task11.c b/set2/task11.c new file mode 100644 index 0000000..60483e0 --- /dev/null +++ b/set2/task11.c @@ -0,0 +1,83 @@ +#include "../lib/lib2.h" +#include "../lib/lib.h" + +int random_number_between(int min, int max) +{ + return (rand() % (max-min) + min); +} + + +int generate_random_bytes(char *buf, int length_key_bytes) +{ + int random_number; + int i; + for(i=0;i