A modern cryptography library in Swift
A modern cryptography library in Swift.
Features • Usage • Installation • Documentation • Author • License
First import Cryptography module.
import Cryptography
Everything you need is available via the Cryptography
facade.
In order to calculate a hash value you simply call Cryptography.hash(message: String, method: HashMethod) -> String
with the desired HashMethod
let hashValue = Cryptography.hash("The quick brown fox jumps over the lazy dog", method: HashMethod.SHA1) // "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"
In order to calculate a MAC value you simply call authenticate(message: String, key: String, method: MACMethod) -> String
with the desired MACMethod
let macValue = Cryptography.authenticate("The quick brown fox jumps over the lazy dog", key: "key", method: MACMethod.HMAC(hashMethod: HashMethod.SHA1)) // "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9"
OS X 10.9+ / iOS 8.0+ / watchOS 2.0 / tvOS 9.0
Xcode 7.1+, Swift 2.1+
CocoaPods is a centralized dependency manager for
Objective-C and Swift. Go here
to learn more.
Add the project to your Podfile.
use_frameworks!
pod 'Cryptography'
Run pod install
and open the .xcworkspace
file to launch Xcode.
Carthage is a decentralized dependency
manager for Objective-C and Swift.
Add the project to your Cartfile.
github "mlachmish/Cryptography"
Run carthage update
and follow the additional steps
in order to add Cryptography to your project.
###Swift Package Manager
You can use Swift Package Manager and specify dependency in Package.swift
by adding this:
.Package(url: "https://github.com/mlachmish/Cryptography.git", majorVersion: 0)
Download and drop /Cryptography
folder in your project.
Matan Lachmish a.k.a The Big Fat Ninja
https://thebigfatninja.xyz
If you believe you have identified a security vulnerability with Cryptography,
please report it as soon as possible via email to [email protected]
Do not post it to the public issue tracker.
Icon made by Freepik from www.flaticon.com
Cryptography is available under the MIT license. See the LICENSE file for more info.