Last active
May 3, 2018 21:34
-
-
Save olbrichj/6ff2c87e0b1689baa246f21b0f54a9b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func rotFinal(msg: String, key: String, op: (UInt32, UInt32) -> UInt32) -> String { | |
return String(zip(msg.unicodeScalars.map{$0.value}, String(repeating: key, count: (msg.count / key.count) + 1) | |
.unicodeScalars.map{$0.value}) | |
.map{Character(UnicodeScalar(op($0.0, $0.1))!)}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment