0
I’m new to Swift, and I’d like to encrypt a string, using some symmetric encryption algorithm so that it’s possible with the same decryption key. I would like to know how this can be done in the Swift language.
0
I’m new to Swift, and I’d like to encrypt a string, using some symmetric encryption algorithm so that it’s possible with the same decryption key. I would like to know how this can be done in the Swift language.
0
Updated: I found a library that does this: https://github.com/krzyzanowskim/CryptoSwift
and the code to solve this problem:
let input = NSData()
let encrypted = try! input.encrypt(AES(key: "secret0key000000", iv:"0123456789012345"))
let input: [UInt8] = [0,1,2,3,4,5,6,7,8,9]
input.encrypt(AES(key: "secret0key000000", iv:"0123456789012345", blockMode: .CBC))
Browser other questions tagged string ios swift xcode cryptography
You are not signed in. Login or sign up in order to post.
First show what you tried, expected to happen and what went wrong and your question. That’s not how this site works.
– Leo Dabus