Generate Argon2 hashes from command line
cargo install argon2-cliOr via cargo-binstall:
cargo binstall argon2-cliecho -n "password" | argon2This CLI accepts the password via stdin, which avoids putting the password in shell history.
argon2 [-h] [salt] [-i|-d|-id] [-t iterations] [-m log2(memory in KiB) | -k memory in KiB] [-p parallelism] [-l hash length] [-e|-r] [-v (10|13)]
[salt]Optional explicit salt; must be at least 8 characters long-iUse Argon2i (default)-dUse Argon2d-idUse Argon2id-tNumber of iterations (default: 3)-mMemory usage of 2^N KiB (default: 12)-kMemory usage of N KiB (default: 4096)-pParallelism threads (default: 1)-lHash output length in bytes (default: 32)-eOutput only encoded hash-rOutput only raw bytes-vArgon2 version (default: 13)
# Basic usage (random salt generated automatically)
echo -n "password" | argon2
# With explicit salt
echo -n "password" | argon2 somesalt
# Use Argon2id with custom parameters
echo -n "password" | argon2 somesalt -id -t 4 -m 16 -p 4
# Output only encoded hash
echo -n "password" | argon2 somesalt -eThis CLI strives for interface compatibility with the C reference implementation, but does not guarantee it. Deviations are made where the original interface significantly hinders usability. For example, the salt is optional in our implementation and a cryptographically secure random salt is generated by default. This CLI also accepts the password via stdin, unlike the standard Linux argon2 CLI, which helps avoid leaking passwords into shell history.
MIT