From 9db81cb91674d45bbb4936a098f4e4fb1a5b45bd Mon Sep 17 00:00:00 2001 From: Benedict Date: Fri, 4 Mar 2016 12:42:08 +0100 Subject: reimplemented task2 --- lib.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'lib.c') diff --git a/lib.c b/lib.c index 4d0d769..252deb2 100644 --- a/lib.c +++ b/lib.c @@ -90,7 +90,7 @@ static void three_bytes_to_base64(char * encode, int bytes_to_print, char *resul * Transform four base64 encoded characters back to three bytes */ -void decode_base64(char *string1, char *result) +void decode_four_base64_byte(char *string1, char *result) { char one, two, three, tmp; // first byte is first six bits of base64 one and 2 bit of base64 second @@ -113,6 +113,16 @@ void decode_base64(char *string1, char *result) printf("%c%c%c", one, two, three); } +void decode_base64(char *string1, char *result) +{ + int i; + + for(i=0;i= length_key) j = 0; @@ -364,7 +374,7 @@ int brute_force_single_byte_xor(char *string, int length, char* keys) for(i=1;i<255;i++) { single_byte_key = (char) i; - xor_string(string, &single_byte_key, xor_tmp); + xor_string(string, &single_byte_key, xor_tmp, 1, length); if (string_looks_like_it_is_human_language(xor_tmp, length)) { keys[number_found_keys++] = single_byte_key; printf("%s\n", xor_tmp); -- cgit v1.2.3-70-g09d2