Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

signalapp/Argon2

Repository files navigation

Argon2 Library

Wrapper around the reference C implementation of Argon2.

Android Usage

implementation 'org.signal:argon2:13.1@aar'
Argon2 argon2 = new Argon2.Builder(Version.V13)
                          .type(Type.Argon2id)
                          .memoryCost(MemoryCost.MiB(32))
                          .parallelism(1)
                          .iterations(3)
                          .build();
                          
                          
Argon2.Result result = argon2.hash(password, salt);

byte[] hash    = result.getHash();
String hashHex = result.getHashHex();
String encoded = result.getEncoded();

iOS Usage

Add the following line to your Podfile:

pod 'SignalArgon2'
let (rawHash, encodedHash) = Argon2.hash(
    iterations: 1,
    memoryInKiB: 32 * 1024,
    threads: 1,
    password: password,
    salt: salt,
    desiredLength: 32,
    variant: .id,
    version: .v13
)