Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikaoj/enigmakit
Enigma encryption in Swift
https://github.com/mikaoj/enigmakit
cipher encryption enigma enigma-machine enigma-simulator swift
Last synced: 3 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 (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-04-09T10:47:12.000Z (almost 6 years ago)
- Last Synced: 2024-11-01T04:51:48.668Z (4 months 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
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, [email protected]
## ๐ท๐๐๐๐๐๐
EnigmaKit is available under the MIT license. See the LICENSE file for more info.