//: Updated code as of Nov 5 2017 import UIKit
let text = UInt8 let cipher = UInt8
var encrypted = UInt8
// encrypt bytes for (i,e) in text.enumerated() { encrypted.append(e ^ cipher[i]) }
var decrypted = UInt8
// decrypt bytes for (i,e) in encrypted.enumerated() { decrypted.append(e ^ cipher[i]) }
String(bytes: decrypted, encoding: String.Encoding.utf8)
//: Updated code as of Nov 5 2017
import UIKit
let text = UInt8
let cipher = UInt8
var encrypted = UInt8
// encrypt bytes
for (i,e) in text.enumerated() {
encrypted.append(e ^ cipher[i])
}
var decrypted = UInt8
// decrypt bytes
for (i,e) in encrypted.enumerated() {
decrypted.append(e ^ cipher[i])
}
String(bytes: decrypted, encoding: String.Encoding.utf8)