## Description
SwiftHash is a lightweight Swift framework that provides a convenient way to hash data using various cryptographic algorithms.
## Features
– Supports hashing with multiple cryptographic algorithms including MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512.
– Easy-to-use API for generating hash values.
– Supports hashing of various data types including strings, data objects, and file paths.
– Provides options to generate hexadecimal or base64 encoded hash values.
– Compatible with Swift 5.0 and above.
## Installation
### Swift Package Manager
You can use Swift Package Manager to easily integrate SwiftHash into your project. Simply follow these steps:
1. In Xcode, open your project and navigate to the target settings.
2. Select the “Swift Packages” tab and click on the “+” button.
3. Enter the SwiftHash repository URL: `https://github.com/someuser/swifthash.git`
4. Choose the desired version rule and click “Next”.
5. Xcode will resolve and download the package. Once resolved, you can import SwiftHash into your code.
### CocoaPods
To integrate SwiftHash using CocoaPods, follow these steps:
1. Specify SwiftHash in your Podfile:
“`
pod ‘SwiftHash’, ‘~> 3.0’
“`
2. Run `pod install` command in the terminal.
3. Open your project using the .xcworkspace file.
4. Import SwiftHash in your Swift files.
### Carthage
To integrate SwiftHash using Carthage, follow these steps:
1. Add SwiftHash to your Cartfile:
“`
github “someuser/swifthash” ~> 3.0
“`
2. Run `carthage update` command in the terminal.
3. Follow the Carthage documentation to add the framework to your project.
4. Import SwiftHash in your Swift files.
### Manually
If you prefer not to use any dependency managers, you can manually add SwiftHash to your project:
1. Download the latest release of SwiftHash from the repository.
2. Drag and drop the SwiftHash.xcodeproj into your Xcode project or workspace.
3. In your project settings, select the target you want to add the framework to.
4. Navigate to the “General” tab, and under “Frameworks, Libraries, and Embedded Content”, click the “+” button.
5. Choose the SwiftHash framework from the list and click “Add”.
6. Import SwiftHash in your Swift files.
## Usage
To use SwiftHash in your Swift project, follow the steps below:
1. Import SwiftHash in your Swift file:
“`swift
import SwiftHash
“`
2. Create an instance of the hash algorithm you want to use:
“`swift
let hash = Hash.md5(“Hello World”)
“`
Replace “md5” with the desired algorithm (md5, sha1, sha224, sha256, sha384, or sha512).
3. Generate the hash value:
“`swift
let result = hash.digest()
“`
## Example
Here’s an example that demonstrates how to use SwiftHash to generate the MD5 hash of a string:
“`swift
import SwiftHash
let hash = Hash.md5(“Hello World”)
let result = hash.digest()
print(result) // Output: “ed076287532e86365e841e92bfc50d8c”
“`
## License
SwiftHash is released under the MIT license. See the [LICENSE](https://github.com/someuser/swifthash/blob/master/LICENSE) file for more details.
## Contributions
Contributions to SwiftHash are welcome! If you have any bug fixes, enhancements, or new features, create a pull request on GitHub.
## Support
If you encounter any issues or have any questions, feel free to [open an issue](https://github.com/someuser/swifthash/issues) on the GitHub repository.
## Acknowledgements
SwiftHash is built upon the works of various cryptographic algorithms and their respective authors. We would like to thank them for their contributions.