Argus

Argon2 password hashing library for Gleam, based on the reference C implementation.

Package VersionHex Docs

This library uses another Pevensie project, jargon, to provide the underlying NIF.

It currently only supports Gleam's Erlang backend.

Example

gleam add argus
import argus
pub fn main() {
// Hash a password using the recommended settings for Argon2id.
let assert Ok(hashes) =
argus.hasher()
|> argus.hash("password")
// Hash a password with custom settings.
let assert Ok(hash_output) =
argus.hasher()
|> argus.algorithm(argus.Argon2id)
|> argus.time_cost(3)
|> argus.memory_cost(12288) // 12 mebibytes
|> argus.parallelism(1)
|> argus.hash_length(32)
|> argus.hash("password")
// Verify a password.
let assert Ok(True) = argus.verify(hash_output.encoded_hash, "password")
}

More information can be found in the documentation.

Default settings

Argus' default settings follow OWASP's minimum recommended configuration guidance, and are as follows:

SettingValue
AlgorithmArgon2id
Time cost (iterations)2
Memory cost19MiB
Parallelism1
Hash length32

Using in Docker

If you want to deploy a Gleam application using Argus in a Docker container, you'll need to make sure your image includes a C compiler to build the Jargon NIF.

Alpine

RUN apk add --no-cache build-base

Debian

RUN apt-get update && apt-get install -y build-essential

Using on Windows

Please see the Jargon README for details on how to ensure Argus will compile on Windows.

Why 'Argus'?

Argus was the builder of the Argo ship and was one of the Argonauts.