cryptopals

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 6a39e1608e35c57d68d9edc8ea6eef7bdd711a10
parent 49211a163b7743a59220a9e189fe5b9a3bb9c866
Author: mpizzzle <michael.770211@gmail.com>
Date:   Sat,  7 Oct 2017 15:43:07 +0100

more formatting

Diffstat:
Mset1/break_repeating_key_xor.py | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/set1/break_repeating_key_xor.py b/set1/break_repeating_key_xor.py @@ -18,7 +18,7 @@ def get_candidate_key_length(file, accuracy): return candidate_length -def get_candidate_xor_byte(transposed_block): +def get_candidate_key_byte(transposed_block): candidate = '' candidate_frequency = 0 @@ -44,7 +44,7 @@ with open('files/6.txt') as f: key_length = get_candidate_key_length(file, 10) split_file = [file[i:i + key_length] for i in range(0, len(file), key_length)] transposed_blocks = [''.join([block[x] for block in split_file[:len(split_file)- 1]]) for x in range(key_length)] -key = ''.join([get_candidate_xor_byte(transposed_block) for transposed_block in transposed_blocks]) +key = ''.join([get_candidate_key_byte(transposed_block) for transposed_block in transposed_blocks]) print key print decrypt(key, file) \ No newline at end of file