From 4e0e29f48f797206a21aa5ba7855ffde72e85cf9 Mon Sep 17 00:00:00 2001 From: Benedict Date: Thu, 4 Aug 2016 19:24:17 +0200 Subject: completed set3, challenge 20 --- set3/Makefile | 8 ++++++-- set3/task20.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 set3/task20.c (limited to 'set3') diff --git a/set3/Makefile b/set3/Makefile index d3b3f03..a6ed5fc 100644 --- a/set3/Makefile +++ b/set3/Makefile @@ -3,12 +3,16 @@ CC=gcc CFLAGS := -g $(CFLAGS) CLIBS=`pkg-config --cflags --libs libcrypto` -all: task17 task18 +all: task17 task18 task19 task20 task17: $(CC) $(CFLAGS) task17.c $(LIB) $(CLIBS) -o task17 task18: $(CC) $(CFLAGS) task18.c $(LIB) $(CLIBS) -o task18 +task19: + $(CC) $(CFLAGS) task19.c $(LIB) $(CLIBS) -o task19 +task20: + $(CC) $(CFLAGS) task20.c $(LIB) $(CLIBS) -o task20 clean: - rm task17 task18 + rm task17 task18 task19 task20 diff --git a/set3/task20.c b/set3/task20.c new file mode 100644 index 0000000..7ab24de --- /dev/null +++ b/set3/task20.c @@ -0,0 +1,64 @@ +#include "../lib/lib.h" +#include "../lib/lib2.h" +#include "../lib/lib3.h" +#include + +#define CHALLENGE20_FILE_NR 60 +int main() +{ + int i; + char **file = malloc(sizeof(char *)*CHALLENGE20_FILE_NR); + int length_file[CHALLENGE20_FILE_NR]; + int length[CHALLENGE20_FILE_NR]; + char **plaintext= malloc(sizeof(char *)*CHALLENGE20_FILE_NR); + char **ciphertext= malloc(sizeof(char *)*CHALLENGE20_FILE_NR); + char filename[] = "./task20_data/task20_00"; + + char nonce[16]; + int min_length = 9999999; + generate_random_bytes(key, 16); + generate_random_bytes(nonce, 16); + + for(i=0;i