Swiftpack.co -  tmthecoder/Argon2Swift as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
An Argon2 Wrapper for Swift
.package(url: "https://github.com/tmthecoder/Argon2Swift.git", from: "1.0.1")


Argon2Swift Swift License: MIT

Swift bindings for the reference C implementation of Argon2, the winner of the Password Hash Competition.

Installation (Cocoapods)

Argon2Swift can be installed via Cocoapods by adding the following to your Podfile:

pod Argon2Swift

Installation (SPM)

Argon2Swift can be installed via SPM (Swift Package Mangeer) by adding the following to your depencencies:

.package(url: "https://github.com/tmthecoder/Argon2Swift.git", .branch("main"))


High-level hashing and verification (for direct hashing & verification of byte arrays, check the example)

import Argon2Swift

// Create a password and a salt
let password = "password"
let s = Salt.newSalt()
//Hash with pre-set params (iterations: 32, memory: 256, parallelism: 2, length: 32, type: Argon2Type.i, version: Argon2Version.V13)
let result = try! Argon2Swift.hashPasswordString(password: password, salt: s)

//Raw hash values available as int list, base 64 string, and hex string
let hashData = result.hashData()
let base64Hash = result.base64String()
let hexHash = result.hexString()

//Encoded hash values available as int list and encoded string
let encodedData = result.encodedData()
let encodedString = result.encodedString()

//Verify password (returns true/false), uses default type (Argon2Type.i)
let verified = try! Argon2Swift.verifyHashString(password: password, hash: stringEncoded);

Features and bugs

Please file feature requests and bugs at the issue tracker.



Stars: 6
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Argon2Swift v1.0.1
21 weeks ago

Cocoapods & Swift Package Manager 1.0.1 Releases of Argon2Swift

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API