diff options
| author | Benedict <benedict@0xb8000.de> | 2016-03-04 12:42:08 +0100 |
|---|---|---|
| committer | Benedict <benedict@0xb8000.de> | 2017-02-21 13:00:24 +0100 |
| commit | 9db81cb91674d45bbb4936a098f4e4fb1a5b45bd (patch) | |
| tree | 2f794833dace3df001803f275a23573f35114a7f /task2.c | |
| parent | d2e94cb263ab933103e1968c0f3da638f35f5983 (diff) | |
reimplemented task2
Diffstat (limited to 'task2.c')
| -rw-r--r-- | task2.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -0,0 +1,27 @@ +#include "lib.h" + + +int main(int argc, char**argv) +{ + if (argc != 3) + return 1; + + + char *xor_string_tmp = malloc(strlen(argv[1])); + char *result = malloc(strlen(argv[1])); + char *str1 = malloc(strlen(argv[1])); + char *str2 = malloc(strlen(argv[2])); + + decode_hex_string(argv[1], str1); + decode_hex_string(argv[2], str2); + xor_string(str1, str2, xor_string_tmp, strlen(argv[2]), strlen(argv[1])); + hex_binary_to_string(xor_string_tmp, result, strlen(argv[1])); + printf("%s\n", result); + + free(xor_string_tmp); + free(result); + free(str1); + free(str2); + + return 0; +} |
