Swift wrapper for the C implementation of Argon2, the winner of the Password Hash Competition.
Argon2Swift can be installed via SPM (Swift Package Manger) by adding the following to your depencencies:
.package(url: "https://github.com/rkreutz/Argon2Kit.git", .upToNextMajor(from: "0.1.0"))
High-level hashing and verification:
import Argon2Kit
let password = "password"
let salt = Data.random(bytes: 16)
let digest = try! Argon2.hash(password: password, salt: salt)
let rawData = digest.rawData // 32 bytes of the hash
let encodedData = digest.encodedData // the Argon2 encoded data
let encodedString = digest.encodedString // the Argon2 encoded string
let isVerified = try! Argon2.verify(password: password, encodedHash: encodedString)
Please file feature requests and bugs at the issue tracker.
- Argon2Kit is Licensed under the MIT License
- The C implementation of Argon2 is licensed under a dual Apache and CC0 License