https://github.com/mikaoj/EnigmaKit
Enigma encryption in Swift
https://github.com/mikaoj/EnigmaKit
cipher encryption enigma enigma-machine enigma-simulator swift
Last synced: 5 months ago
JSON representation
Enigma encryption in Swift
- Host: GitHub
- URL: https://github.com/mikaoj/EnigmaKit
- Owner: mikaoj
- License: mit
- Created: 2015-12-25T18:15:27.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-04-09T10:47:12.000Z (over 6 years ago)
- Last Synced: 2024-11-27T23:30:21.750Z (about 1 year ago)
- Topics: cipher, encryption, enigma, enigma-machine, enigma-simulator, swift
- Language: Swift
- Size: 156 KB
- Stars: 117
- Watchers: 6
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - EnigmaKit - Enigma encryption in Swift. (Security / Encryption)
- awesome-ios-star - EnigmaKit - Enigma encryption in Swift. (Security / Encryption)
- fucking-awesome-ios - EnigmaKit - Enigma encryption in Swift. (Security / Encryption)
README
# ๐ฐ๐๐๐๐๐๐ถ๐๐
[](https://travis-ci.org/mikaoj/EnigmaKit)
[](http://cocoapods.org/pods/EnigmaKit)
[](http://cocoapods.org/pods/EnigmaKit)
[](http://cocoapods.org/pods/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")
```
```swift
let enigma = Enigma()
// "HELLO WORLD"
let result = enigma.encode("ILBDA AMTAZ")
```
## ๐ฎ๐๐๐๐๐๐๐๐๐
#### ๐ป๐๐๐๐๐๐๐๐
```swift
// Create a plugboard and add a patch between A and D
let plugboard = Plugboard()
plugboard.add(("A", "D"))
```
#### ๐ฝ๐๐๐๐
```swift
// 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")
```
#### ๐ฝ๐๐๐๐๐๐๐๐
```swift
// 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")
```
#### ๐ฐ๐๐๐๐๐
```swift
// 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](https://swift.org/package-manager/), [CocoaPods](http://cocoapods.org).
## ๐ฌ๐๐๐๐๐
Joakim Gyllstrรถm, joakim@backslashed.se
## ๐ท๐๐๐๐๐๐
EnigmaKit is available under the MIT license. See the LICENSE file for more info.