You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Will create an Enigma with an empty plugboard, rotors I, II, III and reflector B (wide).
letenigma=Enigma()
// Will output "ILBDA AMTAZ"
letresult= enigma.encode("HELLO WORLD")
// Create a plugboard and add a patch between A and D
letplugboard=Plugboard()
plugboard.add(("A","D"))
𝕽𝖔𝖙𝖔𝖗
// III rotor. EnigmaKit comes prebuilt with rotors I-VIII
letrotor=Rotor.III
rotor.setting =5 // Ringstellung
rotor.position =6 // Grundstellung
// Or initialize your own
letrotor=Rotor(name:"My custom rotor", wiring:"VZBRGITYUPSDNHLXAWMJQOFECK", notch:"QV")
𝕽𝖊𝖋𝖑𝖊𝖈𝖙𝖔𝖗
// EnigmaKit comes with reflectors A-C (wide) and B-C (thin)
letreflector=Reflector.B
// Or you can create your own reflector
letreflector=Reflector(name:"My custom reflector", wiring:"VZBRGITYUPSDNHLXAWMJQOFECK")
𝕰𝖓𝖎𝖌𝖒𝖆
// Create an enigma with your own plugboard, rotors and reflector of choice
letenigma=Enigma(reflector:Reflector.C, rotors:[Rotor.III,Rotor.IV,Rotor.II], plugboard:Plugboard())