rayhaanalykhan/cipherencryption
A Swift library for cryptographic operations using encryption algorithms.
Features
- Support for encrypting strings using common encryption algorithms.
- Simplified API for easy encryption operations.
Algorithms List
- SHA1
- SHA224
- SHA256
- SHA384
- SHA512
Installation
Swift Package Manager (SPM) using Xcode
To integrate SwiftStrideIO into your Xcode project using Swift Package Manager, follow these steps:
- Open your project in Xcode.
- Navigate to the menu bar and click
File>Swift Packages>Add Package Dependency.... - In the search bar of the new window that appears, paste the following URL:
https://github.com/rayhaanalykhan/CipherEncryption.git - Follow the on-screen instructions to choose the package options and the version you want to integrate.
- Once completed, Xcode will download the package and add it to your project navigator.
Usage
To use CipherEncryption into your project, you can utilize the following approaches:
- Encrypt using computed properties:
Encrypt the string using one of encryption algorithm eg: SHA-256.
```swift
let someString = "someString"
if let encryptedString = someString.ce.SHA256 { // ce = CipherEncryption print(encryptedString) } else { print("Could not encrypt this: '\(someString)' in SHA256") } `` `swift // Alternate print("someString".ce.SHA1 ?? "Couldn't be encrypted") ``
- Encrypt using encrypt function:
Similary you can use the encrypt function to encrypt the string.
```swift let someString = "someString"
if let encryptedString = someString.encrypt(.SHA1) { print(encryptedString) } else { print("Could not encrypt this: '\(someString)' in SHA256") } `` `swift // Alternate print("someString".encrypt(.SHA1) ?? "Couldn't be encrypted") ``
Using function is more feasible in some cases, you can use the enum defined on String class extension and pass it in a function. Example, here it is used in a different module, using function will provide the user with any future cases.
License
CipherEncryption is released under the MIT License. See the LICENSE file for further details.
Contribution
Contributors are welcomed to fork the project and submit pull requests. Please include unit tests if possible for any new or existing functionality. Also, update the README accordingly.
Contact
For further information, contact me via email rayhaanalykhan@gmail.com.
Package Metadata
Repository: rayhaanalykhan/cipherencryption
Default branch: main
README: README.md