Enigma encryption in Swift
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commitโ€ฆ
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
EnigmaKit.xcodeproj Rewrite Jul 7, 2017
Sources/EnigmaKit Synced README and code Jul 7, 2017
Tests Rewrite Jul 7, 2017
.gitignore Rewrite Jul 7, 2017
.swift-version Rewrite Jul 7, 2017
.travis.yml Rewrite Jul 7, 2017
EnigmaKit.podspec Rewrite Jul 7, 2017
LICENSE Code dump Dec 25, 2015
Package.swift Rewrite Jul 7, 2017
README.md Update README.md Jul 8, 2017
enigma.gif Added gif Dec 25, 2015

README.md

๐•ฐ๐–“๐–Ž๐–Œ๐–’๐–†๐•ถ๐–Ž๐–™

CI Status Version License Platform Alt text

๐–€๐–˜๐–†๐–Œ๐–Š

// 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.