argon2
A pure-Rust implementation of the Argon2 password hashing function
Repository Health
Technical Analysis
argon2 is a pure-Rust implementation of Argon2, the memory-hard password hashing function that won the Password Hashing Competition in 2015. It implements all three algorithmic variants — Argon2d (GPU-cracking resistant), Argon2i (side-channel resistant), and Argon2id (the recommended hybrid default) — and integrates with the RustCrypto password-hash crate for PHC string encoding/decoding and trait-based password verification.
The crate is part of the RustCrypto password-hashes workspace, which also houses PBKDF2, scrypt, bcrypt-pbkdf, Balloon hashing, SHA-crypt, and yescrypt implementations sharing a common PasswordVerifier/PasswordHash (PHC string) interface. It supports no_std environments (including without alloc), making it usable in embedded targets as well as standard server-side authentication code.
What You Get
- All three Argon2 variants (Argon2d, Argon2i, and the default Argon2id hybrid)
- Optional integration with the
password-hashcrate for PHC string encoding/parsing and a commonPasswordVerifiertrait shared with pbkdf2, scrypt, and other RustCrypto hashers no_stdsupport, includingalloc-free configurations for embedded/constrained targets- Optional
parallelfeature (viarayon) for multi-threaded hashing and azeroizefeature for secure memory wiping of sensitive buffers - Configurable
Paramsfor memory cost, time cost, and parallelism tuning per OWASP recommendations
Common Use Cases
- Hashing and verifying user passwords for authentication in a Rust web service or CLI tool
- Building a multi-algorithm password verifier that can check hashes produced by Argon2, PBKDF2, or scrypt against a single PHC-format string
- Deriving encryption keys from a low-entropy passphrase (e.g. for at-rest file/database encryption) using Argon2’s memory-hard KDF properties
- Embedded or constrained targets that need password/key hashing without a standard allocator (
no_std, no-allocbuilds)
Under The Hood
Architecture: The crate is organized around algorithm.rs (Argon2 core: block filling, mixing, and the d/i/id variant dispatch), block.rs (the 1KB Argon2 memory block type and operations over it), memory.rs (the working-memory matrix the algorithm iterates over), blake2b_long.rs (the variable-output Blake2b hash used internally by Argon2), params.rs (memory/time/parallelism cost parameters and validation), and error.rs/version.rs; lib.rs ties these into the public Argon2 struct implementing the optional password-hash crate’s PasswordHasher/PasswordVerifier traits. Tech Stack: Rust 2024 edition (MSRV 1.85), no_std-first with alloc as an additive feature; depends on base64ct (constant-time base64 for PHC strings) and blake2 for the internal hash primitive, with optional rayon (parallel feature) and zeroize (secure memory wiping) as opt-in features. Code Quality: Ships an extensive [lints.clippy]/[lints.rust] block enforcing missing_docs, unwrap_used warnings, cast-safety lints, and undocumented-unsafe-block checks — a notably strict lint posture for a security-sensitive crate — plus a tests/ directory with known-answer vectors; CI badges reference a dedicated argon2.yml workflow. API Design: The crate offers both a minimal low-level API (Argon2::new(...).hash_password(...)) and, through the shared password-hash trait objects, a pluggable multi-algorithm verifier pattern (as shown in the repo’s own README) that lets callers check a PHC hash string against Argon2, PBKDF2, or scrypt without knowing in advance which algorithm produced it — a deliberate ergonomic win for migrating between hashing schemes.
Used by 10 apps in this directory
Bramble
Password Manager · Security · Authentication
Local-first, end-to-end encrypted password manager that syncs your vault directly between your own devices over a private peer-to-peer mesh — no server, no account, no cloud in the middle.
hoodik
File Storage · Security
Self-hosted, end-to-end encrypted cloud storage with browser-based encryption and S3-compatible storage support
Hook0
Devops
Open-source Webhooks-as-a-Service: deliver events to your users with auto-retry, signed payloads, and a real-time subscriber dashboard — all without building the infrastructure yourself.
Kuku
Note Taking
A local-first, open-source Markdown knowledge workspace for macOS — plain files, personal wiki and Second Brain workflows, AI-assisted diffs, and encrypted sync, built as an Obsidian alternative.
Lokus
Note Taking · Knowledge Management
Local-first note-taking with graph view, canvas & AI plugins—your Markdown files, zero telemetry, blazing-fast Rust performance.
mesh-llm
AI Development · AI Agents
Mesh LLM pools GPUs and memory across every machine you own into one OpenAI-compatible API, so agents tap distributed compute instead of a single GPU box or a metered cloud bill.
Spacedrive
File Storage · Collaboration
One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.
Stalwart
Collaboration
All-in-one secure mail and collaboration server covering IMAP, JMAP, SMTP, CalDAV, CardDAV, and WebDAV in a single memory-safe Rust binary.
Tabby
AI Code Assistants
Self-hosted AI coding assistant — run GitHub Copilot-grade code completion on your own hardware with no cloud dependency.