detect_single_character_xor.py (245B)
1 hex_strings = open('files/4.txt') .read().splitlines() 2 3 for hex in hex_strings: 4 for plaintext in [''.join([chr(x ^ ord(a)) for a in hex.decode("hex")]) for x in range(256)]: 5 if " the " in plaintext: 6 print plaintext