BMHCrypto is a pure Swift packages built on CryptoKit, adds useful extensions and ready to use.
Why?
Simplify usage of cryptographic operation such as hashing, encryption / decryption. Pure Swift, I am not gonna reinvent the wheel, package always will be based on CryptoKit or whatever released by Apple.
Important: These algorithms aren’t considered cryptographically secure, but are provided for backward compatibility with older services that require them. For new services, avoid these algorithms.
Cryptographically Secure Hashes
SHA256
SHA384
SHA512
Ciphers
AES
ChaChaPoly
Message Authentication Codes
HMAC
SymmetricKey
Public-Key Cryptography
🔥 Usage
Do not forget to import
import BMHCrypto
Hashing
// Anything That Conforms DataProtocol
let plainText = "BMH"
ChaChaPoly
```swift
// Share Same Key
let key = SymmetricKey(size: .bits256)
// Plain Data Could Be Anything
let data = Data()
// Encrypt
let encrypted = data.encryptChaChaPoly(with: key)
// Decrypt
let decrypted = encrypted.decryptChaChaPoly(with: key)
- AES
```swift
// Share Same Key
let key = SymmetricKey(size: .bits256)
// Plain Data Could Be Anything
let data = Data()
// Encrypt
let encrypted = data.encryptAES(with: key)
// Decrypt
let decrypted = encrypted?.decryptAES(with: key)
Sharing Key
let key = SymmetricKey(size: .bits256)
// Shareable String Key
let savedKey = key.base64EncodedString
// Ready to Use SymmetricKey
let convertedKey = savedKey.asSymmetricKey
👨🏻💻 Author
Mustafa Hasturk
📧 mustafa[at]hasturk.dev
❤️ Contributing
Bug reports and pull requests are welcome.
👮🏻♂️ License
BMHCrypto is released under the MIT license. See LICENSE for more information.
BMHCrypto
BMHCrypto is a pure Swift packages built on CryptoKit, adds useful extensions and ready to use.
Why?
Simplify usage of cryptographic operation such as hashing, encryption / decryption. Pure Swift, I am not gonna reinvent the wheel, package always will be based on CryptoKit or whatever released by Apple.
📋 Requirements
📲 Installation
Swift Package Manager
Xcode Project
Swift Package Manager is built into new versions of Xcode. To install
BMHCrypto
with SPM:Open your project in Xcode
Click “File” -> “Swift Packages” -> “Add Package Dependency…”
Paste the following URL:
https://github.com/muhasturk/BMHCrypto.git
As Dependecy
You can use The Swift Package Manager to install
BMHCrypto
by adding the proper description to yourPackage.swift
file:Next, add
BMHCrypto
to your targets dependencies like so:Then run
swift package update
.🎁 Features
Insecure Hash
Cryptographically Secure Hashes
Ciphers
Message Authentication Codes
Public-Key Cryptography
🔥 Usage
Do not forget to import
Hashing
Ciphers
// Plain Data Could Be Anything let data = Data()
// Encrypt let encrypted = data.encryptChaChaPoly(with: key)
// Decrypt let decrypted = encrypted.decryptChaChaPoly(with: key)
Sharing Key
👨🏻💻 Author
Mustafa Hasturk 📧 mustafa[at]hasturk.dev
❤️ Contributing
Bug reports and pull requests are welcome.
👮🏻♂️ License
BMHCrypto is released under the MIT license. See LICENSE for more information.