-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript2.py
More file actions
24 lines (19 loc) · 738 Bytes
/
script2.py
File metadata and controls
24 lines (19 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from enigma import Machine, generatePositionSettings
code = "CMFSUPKNCBMUYEQVVDYKLRQZTPUFHSWWAKTUGXMPAMYAFITXIJKMH"
crib = "UNIVERSITY"
code_number = "2"
rotors = "Beta I III"
reflector = "B"
ring_settings="23 02 10"
starting_positions = "UNKNOWN"
plugboard_pairs = "VH PT ZG BJ EY FS"
for position_setting in generatePositionSettings():
machine = Machine(rotors=rotors,
reflector=reflector,
ring_setting=ring_settings,
position_setting=position_setting,
plugboard_mappings=plugboard_pairs)
result = machine.encode(code)
if crib in result:
break
print(f"code {code_number} = {result}, position_setting = {position_setting}")