summaryrefslogtreecommitdiff
path: root/set3
diff options
context:
space:
mode:
authorBenedict <benedict@0xb8000.de>2016-08-04 14:28:15 +0200
committerBenedict <benedict@0xb8000.de>2017-02-21 13:00:25 +0100
commit11b2ff584c67cf85ebe2405f6a74ab2799736927 (patch)
treeeb5e99a5f4f77ceae37f4d2a3e3d5f4a63bc4bc4 /set3
parent896bb17f14e44925f5cdacbe10f1e86c20b88972 (diff)
completed set3, task 18
Diffstat (limited to 'set3')
-rw-r--r--set3/Makefile14
-rw-r--r--set3/task18.c20
2 files changed, 34 insertions, 0 deletions
diff --git a/set3/Makefile b/set3/Makefile
new file mode 100644
index 0000000..d3b3f03
--- /dev/null
+++ b/set3/Makefile
@@ -0,0 +1,14 @@
+LIB=../lib/lib2.c ../lib/lib.c ../lib/lib3.c
+CC=gcc
+CFLAGS := -g $(CFLAGS)
+CLIBS=`pkg-config --cflags --libs libcrypto`
+
+all: task17 task18
+
+task17:
+ $(CC) $(CFLAGS) task17.c $(LIB) $(CLIBS) -o task17
+
+task18:
+ $(CC) $(CFLAGS) task18.c $(LIB) $(CLIBS) -o task18
+clean:
+ rm task17 task18
diff --git a/set3/task18.c b/set3/task18.c
new file mode 100644
index 0000000..072156a
--- /dev/null
+++ b/set3/task18.c
@@ -0,0 +1,20 @@
+#include "../lib/lib.h"
+#include "../lib/lib2.h"
+#include "../lib/lib3.h"
+#include <time.h>
+
+int main()
+{
+ char *file;
+ int length_file = read_base64_file("task18.txt", &file);
+ char *ciphertext = malloc(length_file);
+ int length = decode_base64(file, ciphertext);
+
+ char *decrypted = malloc(length);
+ char *key = "YELLOW SUBMARINE";
+ char nonce[16];
+ memset(nonce, 0, 16);
+ aes_ctr(ciphertext, length, decrypted, key, nonce);
+
+ printf("plaintext: %s\n", decrypted);
+}