From ddce9b2d44ab48fc566870c5155b39c8fc06f24d Mon Sep 17 00:00:00 2001 From: Benedict Date: Tue, 21 Feb 2017 12:52:02 +0100 Subject: moved files of set1 into subdir --- set1/caesar.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 set1/caesar.c (limited to 'set1/caesar.c') diff --git a/set1/caesar.c b/set1/caesar.c new file mode 100644 index 0000000..b8670c5 --- /dev/null +++ b/set1/caesar.c @@ -0,0 +1,21 @@ +#include "lib.h" + + +int main(int argc, char **argv) +{ + if (argc != 3) { + printf("Usage: %s \n\noutput: ciphertext\n", argv[0]); + exit(1); + } + + char *ciphertext = malloc(strlen(argv[1])+1); + char *hex_ciphertext = malloc(strlen(argv[1])*2); + + xor_string(argv[1], argv[2], ciphertext, strlen(argv[2]), strlen(argv[1])); + + hex_binary_to_string(ciphertext, hex_ciphertext, strlen(argv[1])); + + printf("%s\n", hex_ciphertext); + + return 0; +} -- cgit v1.2.3-70-g09d2