Created
November 7, 2014 16:07
-
-
Save michielappelman/90cd7267781e8e67511d to your computer and use it in GitHub Desktop.
Enigma brute-forcer for http://www.maths.manchester.ac.uk/cryptography_competition_the_imitation_game/index.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enigma.machine import EnigmaMachine | |
import string | |
# setup machine according to specs from a daily key sheet: | |
plug = 'LDERFAS' | |
for ch1 in string.ascii_uppercase: | |
for ch2 in string.ascii_uppercase: | |
for ch3 in string.ascii_uppercase: | |
for ch4 in [x for x in string.ascii_uppercase if x not in plug]: | |
machine = EnigmaMachine.from_key_sheet( | |
rotors='III I II', | |
reflector='B', | |
ring_settings='S B E', | |
plugboard_settings='LD ER FA S' + ch4) | |
machine.set_display(ch1 + ch2 + ch3) | |
ciphertext = 'RPVZLYNCQORVUSYUZUBCKNIBKDWZRPFZVLA' | |
plaintext = machine.process_text(ciphertext) | |
print plaintext + ' ' + ch1 + ch2 + ch3 + ' S' + ch4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment