mikaoj/enigmakit
```swift
๐๐๐๐๐
// Will create an Enigma with an empty plugboard, rotors I, II, III and reflector B (wide).
let enigma = Enigma()
// Will output "ILBDA AMTAZ"
let result = enigma.encode("HELLO WORLD")let enigma = Enigma()
// "HELLO WORLD"
let result = enigma.encode("ILBDA AMTAZ")๐ฎ๐๐๐๐๐๐๐๐๐
๐ป๐๐๐๐๐๐๐๐
// Create a plugboard and add a patch between A and D
let plugboard = Plugboard()
plugboard.add(("A", "D"))๐ฝ๐๐๐๐
// III rotor. EnigmaKit comes prebuilt with rotors I-VIII
let rotor = Rotor.III
rotor.setting = 5 // Ringstellung
rotor.position = 6 // Grundstellung
// Or initialize your own
let rotor = Rotor(name: "My custom rotor", wiring: "VZBRGITYUPSDNHLXAWMJQOFECK", notch: "QV")๐ฝ๐๐๐๐๐๐๐๐
// EnigmaKit comes with reflectors A-C (wide) and B-C (thin)
let reflector = Reflector.B
// Or you can create your own reflector
let reflector = Reflector(name: "My custom reflector", wiring: "VZBRGITYUPSDNHLXAWMJQOFECK")๐ฐ๐๐๐๐๐
// Create an enigma with your own plugboard, rotors and reflector of choice
let enigma = Enigma(reflector: Reflector.C, rotors: [Rotor.III, Rotor.IV, Rotor.II], plugboard: Plugboard())๐ฝ๐๐๐๐๐๐๐๐๐๐๐
Don't mention the war
๐ด๐๐๐๐๐๐๐๐๐๐๐
EnigmaKit is available through Swift Package Manager, CocoaPods.
๐ฌ๐๐๐๐๐
Joakim Gyllstrรถm, joakim@backslashed.se
๐ท๐๐๐๐๐๐
EnigmaKit is available under the MIT license. See the LICENSE file for more info.
Package Metadata
Repository: mikaoj/enigmakit
Default branch: master
README: README.md