EnigmaMachine

Enigma.EnigmaMachineMethod
EnigmaMachine()

Return a EnigmaMachine in the starting position: Rotors I,II,III, UKW A and rotor positions 1,1,1 (A,A,A)

source
Enigma.EnigmaMachineMethod
EnigmaMachine(r1::Int, r2::Int, r3::Int, ukw::Int; p1=1, p2=1, p3=1)

Creates an EnigmaMachine with the following setting:

Rotor ids from left to right: r1, r2, r3

r1=1 would be setting the left most rotor to the rotor I

The reflector ( = ukw = Umkehrwalze) is 1,2,3 as well and correspond to the ukws A,B and C

Additionally the rotor positions can be set using p1,p2 and p3 for the three rotors

Return the created EnigmaMachine

source
Enigma.set_rotors!Method
set_rotors!(enigma::EnigmaMachine, r1, r2, r3)

Set the rotors of enigma to r1, r2 and r3 from left to right.

source
Enigma.set_ukw!Method
set_ukw!(enigma::EnigmaMachine, ukw)

Set the reflector (=Umkehrwalze = UKW) of the enigma. Currently ukw can be 1,2,3 for UKW A, UKW and UKW C

source
Enigma.set_plugboard!Method
set_plugboard!(enigma::EnigmaMachine, setting::Vector{Tuple{Int,Int}})

Change the plugboard of the enigma and set it to the new setting.

[(1,2), (3,4)] would mean that there are two plugs one connecting A and B and one connecting C and D.

See also set_plugboard(enigma::EnigmaMachine, setting::String)

source
Enigma.set_plugboard!Method
set_plugboard!(enigma::EnigmaMachine, setting::String)

Change the plugboard of the enigma and set it to the new setting.

AB BC would mean that there are two plugs one connecting A and B and one connecting C and D.

See also set_plugboard(enigma::EnigmaMachine, setting::Vector{Tuple{Int,Int}})

source
Enigma.encode!Method
encode!(enigma::EnigmaMachine, s::String; input_validation=true, output_style=:enigma)

If all chars in the string are uppercase letters (so no spaces) then input_validation can be set to false for a bit speed up.

The default output consists of blocks of five letters. If you don't want the spaces you can set output_style=false.

Return the string encoded with the enigma.

source
Enigma.decode!Method
decode!(enigma::EnigmaMachine, s::String; input_validation=true, output_style=:enigma)

Does the same as encode ;)

source
Enigma.enigma_styled_textMethod
enigma_styled_text(text::String)

Return creates an enigma styled text which means it replaces all chars which are not letters and makes them uppercase. It also makes blocks of five letters for better or worse readability :D

source

Bombe

Enigma.enable_ambiguous!Method
enable_ambiguous!(bombe::BombeMachine)

Be sure that the actual message gets found. This takes often much longer and uses lots of RAM :/

I would say most of the time it is not necessary.

source
Enigma.set_possible_rotors!Method
set_possible_rotors!(bombe::BombeMachine, rotor_1, rotor_2, rotor_3)

Set the rotors that should be checked. Each rotor can be either an integer or a vector of integers (or range).

i.e set_possible_rotors!(bombe::BombeMachine, 1, 2:3, [4,5])

source
Enigma.set_possible_rotor_positions!Method
set_possible_rotor_positions!(bombe::BombeMachine, rp1, rp2, rp3)

Set the rotor positions that should be checked. Each rotor position can be either an integer or a vector of integers (or range).

i.e set_possible_rotor_positions!(bombe::BombeMachine, 1, 1:26, [20,22,25])`

source
Enigma.set_possible_hint_positions!Method
set_possible_hint_positions!(bombe::BombeMachine, hint_positions)

Set the positions in the secret the hint might appeared.

i.e if you're sure it's the first word you can use set_possible_hint_positions!(bombe::BombeMachine, 1) or

if you know that it is at least in the beginning you can use something like set_possible_hint_positions!(bombe::BombeMachine, 1:20).

source
Enigma.set_hint!Method
set_hint!(bombe::BombeMachine, hint::String)

This changes the hint used for cracking.

source
Enigma.set_secret!Method
set_secret!(bombe::BombeMachine, secret::String)

This changes the secret used for cracking.

source
Enigma.run_crackingMethod
run_cracking(bombe::BombeMachine; log=true)

Start the cracking process.

Does not give you all possibilities if you haven't run enable_ambiguous! but this is normally not reasonable.

Return possible enigma settings to understand the secret message.

source