summaryrefslogtreecommitdiff
path: root/task4.c
diff options
context:
space:
mode:
authorBenedict <benedict@0xb8000.de>2017-02-21 12:52:02 +0100
committerBenedict <benedict@0xb8000.de>2017-02-21 13:00:25 +0100
commitddce9b2d44ab48fc566870c5155b39c8fc06f24d (patch)
tree61e6f8d636190ef19f75bfd9cd8e4861ee04cf4f /task4.c
parentf71df313c4480fb3edd91edb572d8013bec6d352 (diff)
moved files of set1 into subdir
Diffstat (limited to 'task4.c')
-rw-r--r--task4.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/task4.c b/task4.c
deleted file mode 100644
index 11fab98..0000000
--- a/task4.c
+++ /dev/null
@@ -1,37 +0,0 @@
-
-#include "lib.h"
-
-int main() {
- /** read the file */
- FILE *fp;
- int malloc_size = 62;
- int line_number = 0;
- int j;
- char key;
- char *string = malloc(malloc_size);
- char *string2 = malloc(malloc_size);
- char *cleartext = malloc(malloc_size);
- struct key_and_freq tmp;
-
- fp = fopen("4.txt", "r");
-
- if (fp == NULL) {
- printf("Error open file\n");
- exit(1);
- }
-
- while (fscanf(fp, "%61c", string) != EOF) {
- tmp.hits = 0;
- j = decode_hex_string(string, string2);
- key = brute_force_single_byte_xor(string2, j, &tmp);
- xor_string(string2, &key, cleartext, 1, j);
- if ((!isprintable(cleartext, j)) || (tmp.hits < 10))
- continue;
-
- printf("%s", cleartext);
- line_number++;
- }
-
- fclose(fp);
- return 0;
-}