Update README.md
Provides Advanced Encryption Standard (AES) capabilities.
Advanced Encryption Standard (AES)
CCCrypt
import CommonCrypto
Cipher Block Chaining (CBC)
Initialization Vector (IV)
key size
kCCOptionPKCS7Padding
CCOptions
(More on the topic from WWDC 2019: Adopting Swift Packages in Xcode and Creating Swift Packages.)
In your Package.swift, add AESCryptable as a dependency:
Package.swift
AESCryptable
dependencies: [ // 🔐 AES encryption/decryption with random iv. Swift 5 and up. .package(url: "https://github.com/backslash-f/aescryptable", from: "1.0.0") ],
Associate the dependency with your target:
targets: [ .target(name: "App", dependencies: ["AESCryptable"]) ]
Run: swift build
swift build
import AESCryptable do { // encrypt let aes = try AES(keyString: "01234567890123456789012345678901") let encryptedData = try aes.encrypt("The black knight always triumphs!") // decrypt let decryptedString = try aes.decrypt(encryptedData) print(decryptedString) // The black knight always triumphs! } catch { print(error) }
(Refer to the test class for a high-level overview.)
Clone the repo and use AESCryptable.playground to see the code in action:
AESCryptable.playground
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
AESCryptable
Provides
Advanced Encryption Standard (AES)
capabilities.CCCrypt
(viaimport CommonCrypto
).Cipher Block Chaining (CBC)
mode with randomInitialization Vector (IV)
.key size
. This is by design.kCCOptionPKCS7Padding
asCCOptions
by default.Integration
Xcode 11+
(More on the topic from WWDC 2019: Adopting Swift Packages in Xcode and Creating Swift Packages.)
Via Package.swift
In your
Package.swift
, addAESCryptable
as a dependency:Associate the dependency with your target:
Run:
swift build
Usage
(Refer to the test class for a high-level overview.)
Demo
Clone the repo and use
AESCryptable.playground
to see the code in action: