Android-PHP-Encrypt-Decrypt icon indicating copy to clipboard operation
Android-PHP-Encrypt-Decrypt copied to clipboard

Can you provide Objective-c / Swift code

Open HimanshuParashar opened this issue 6 years ago • 2 comments

I want to implement this in my IOS project. Is their any alternative solution for Objective-c / Swift code?

HimanshuParashar avatar Oct 26 '17 14:10 HimanshuParashar

I want to implement this in my IOS project. Is their any alternative solution for Objective-c / Swift code?

Use this pod: - https://github.com/krzyzanowskim/CryptoSwift/tree/swift32

extension String { func aes_Encrypt() -> String { let key = "0123456789abcdef" let iv = "fedcba9876543210" var result = "" do { let aes = try! AES(key: key, iv: iv, padding: Padding.zeroPadding) let encrypted = try aes.encrypt(Array(self.utf8)) result = encrypted.toHexString() } catch { print(error) } return result } }

// Use:-

let str = // YOUR STRING

let result = str.aes_Encrypt() // "result" is your encrypted string

kishanbarmawala avatar Mar 20 '20 12:03 kishanbarmawala

Thanks @kishanbarmawala I didn't have time to create one and the one you provided seems really good.

serpro avatar Mar 20 '20 12:03 serpro