Skip to content

Instantly share code, notes, and snippets.

@SunXiaoShan
Last active January 6, 2020 15:45
Show Gist options
  • Save SunXiaoShan/3b4255a51debb6e138d2041ab19560ab to your computer and use it in GitHub Desktop.
Save SunXiaoShan/3b4255a51debb6e138d2041ab19560ab to your computer and use it in GitHub Desktop.
inputkey.text = "keykeykeykeykeyk"
inputIv.text = "drowssapdrowssap"
orgiTextView.text = "helloworld"
if
// 先做 AES-128 encode
let aes = try? AES(key: inputkey.text!, iv: inputIv.text!) ,
let encrypted = try? aes.encrypt(orgiTextView.text!.bytes) ,
// 再把結果用 base64 成文字顯示出來
let EncData = encrypted.toBase64()
{
crypTextView.text = EncData
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment