diff options
| author | Benedict <benedict@0xb8000.de> | 2017-02-21 12:52:02 +0100 |
|---|---|---|
| committer | Benedict <benedict@0xb8000.de> | 2017-02-21 13:00:25 +0100 |
| commit | ddce9b2d44ab48fc566870c5155b39c8fc06f24d (patch) | |
| tree | 61e6f8d636190ef19f75bfd9cd8e4861ee04cf4f /set1/task2.c | |
| parent | f71df313c4480fb3edd91edb572d8013bec6d352 (diff) | |
moved files of set1 into subdir
Diffstat (limited to 'set1/task2.c')
| -rw-r--r-- | set1/task2.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/set1/task2.c b/set1/task2.c new file mode 100644 index 0000000..59739d8 --- /dev/null +++ b/set1/task2.c @@ -0,0 +1,28 @@ +#include "../lib/lib.h" + + +int main(int argc, char**argv) +{ + if (argc != 3) + return 1; + + int length_arg_1 = strlen(argv[1]); + int length_arg_2 = strlen(argv[2]); + char *xor_string_tmp = malloc(length_arg_1+1); + char *result = malloc(length_arg_1*2+1); + char *str1 = malloc(length_arg_1+1); + char *str2 = malloc(length_arg_2+1); + + decode_hex_string(argv[1], str1); + decode_hex_string(argv[2], str2); + xor_string(str1, str2, xor_string_tmp, length_arg_2, length_arg_1); + hex_binary_to_string(xor_string_tmp, result, (length_arg_1/2)); + printf("%s\n", result); + + free(xor_string_tmp); + free(result); + free(str1); + free(str2); + + return 0; +} |
