CryptoSwift是Swift实现的Crypto相关的函数。
// convenience setup tuplelet setup = (key: keyData, iv: ivData)// encryptif let encrypted = Cipher.ChaCha20(setup).encrypt(dataToEncrypt) { // decrypt if let decrypted = Cipher.ChaCha20(setup).decrypt(encrypted) { // validate result if (encrypted.isEqual(decrypted)) { print("Decryption failed!") } }}点击空白处退出提示
评论