argon2-cffi

Secure, high-level password hashing for Python using Argon2

Library
PyPI
v25.1.0
727stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
70/100Good
Development Activity76
Maintenance60
Community56
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
84/100Excellent
Architecture84
Code Quality90
Innovation72
Learning Curve88

argon2-cffi is the standard Python library for hashing and verifying passwords with Argon2, the algorithm that won the Password Hashing Competition and is now widely recommended (including by OWASP) as the default choice for new applications. Its PasswordHasher class wraps the sensible-defaults complexity of Argon2’s memory cost, time cost, and parallelism parameters behind a two-method API: hash(password) and verify(hash, password).

Under the hood, the high-level API sits on top of low_level.py, which exposes the raw Argon2 primitives directly for advanced users, and on the separate argon2-cffi-bindings package (also maintained by the same author) for the actual CFFI/C bindings to the reference Argon2 implementation. The project also ships a check_needs_rehash() helper and a profiles module with pre-tuned parameter sets (RFC-recommended, low-memory, etc.) so applications can adopt secure defaults without tuning Argon2 parameters themselves.

What You Get

  • PasswordHasher class with hash(), verify(), and check_needs_rehash() for full password lifecycle management
  • Pre-tuned parameter profiles (e.g. RFC-9106 recommended, low-memory) so apps don’t have to hand-tune Argon2 cost parameters
  • A low_level module exposing raw hash_secret/verify_secret primitives for advanced/custom use cases
  • Typed exceptions (VerifyMismatchError, VerificationError, InvalidHash) for precise error handling in auth flows
  • A __main__ CLI entry point for quick command-line hashing/benchmarking
  • Binary wheels for major platforms via the companion argon2-cffi-bindings package, avoiding a local C toolchain requirement

Common Use Cases

  • Hashing and verifying user passwords in a web application’s authentication system, replacing bcrypt/PBKDF2
  • Upgrading legacy password hashes over time using check_needs_rehash() as cost parameters are tuned upward
  • Choosing security/performance trade-offs via profiles presets instead of manually tuning memory/time cost
  • Framework integration as the password hasher backend for Django, Flask-Security, or custom auth stacks
  • Benchmarking or scripting Argon2 hashing operations directly from the command line via the bundled CLI

Under The Hood

Architecture_password_hasher.py’s PasswordHasher class is a thin, opinionated layer over low_level.py, which itself calls into the separate argon2-cffi-bindings package’s CFFI bindings to the vendored C reference implementation of Argon2; _legacy.py preserves an older, pre-PasswordHasher API for backward compatibility, and profiles.py centralizes named parameter presets so callers don’t hardcode cost values. Tech Stack — Pure Python 3.9+ packaged with Hatchling/hatch-vcs, depending on the sibling argon2-cffi-bindings package for the actual C/CFFI layer — keeping this package itself free of a compiled build step while still shipping binary-wheel-backed performance. Code Quality — Test coverage is split cleanly by concern (test_password_hasher.py, test_low_level.py, test_legacy.py, test_utils.py, test_packaging.py), the project carries a CII Best Practices badge, and it enforces full type hints (py.typed marker) — a notably high bar for a security-critical dependency used across the Python ecosystem. API DesignPasswordHasher().hash(password) / .verify(hash, password) is the entire happy-path API surface, deliberately hiding Argon2’s five tunable cost parameters behind sane defaults and named profiles, which is precisely why it is the go-to library over hand-rolling low_level calls.

Used by 8 apps in this directory

Python
54%
Other

authentik

Authentication · Security

24,980

The self-hosted Identity Provider that replaces Okta, Auth0, and Entra ID with a unified SSO platform supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and WebAuthn.

View details
92
Repo Health
81
Technical
68
Dependency
Built with
Python54%
TypeScript33%
Updated today
C++
69%
Apache 2.0

ClickHouse

Databases · Analytics · Data Engineering

49,325

Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.

View details
95
Repo Health
90
Technical
68
Dependency
Built with
C++69%
Python13%
Updated today
Python
83%
Apache 2.0

knowhere

AI Development · Developer Tools

2,515

Transform messy, unstructured documents into persistent, navigable memory that AI agents can actually use.

View details
83
Repo Health
75
Technical
70
Dependency
Built with
Python83%
HTML16%
Updated today
Python
60%
MIT

LibrePhotos

File Storage

8,044

Self-hosted photo library with AI-powered face recognition, semantic search, and automatic event albums — no cloud required.

View details
82
Repo Health
78
Technical
67
Dependency
Built with
Python60%
TypeScript37%
Updated 3 days ago
Python
37%
Other

Open WebUI

AI Assistants · AI Agents

149,204

The extensible, privacy-first AI platform that runs Ollama, OpenAI, and any LLM backend behind a polished, feature-packed web interface.

View details
91
Repo Health
75
Technical
66
Dependency
Built with
Python37%
Svelte33%
JavaScript22%
Updated today
Python
74%
AGPL 3.0

OpenViking

Databases · AI Development

29,711

An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.

View details
84
Repo Health
75
Technical
65
Dependency
Built with
Python74%
Rust14%
Updated today
TypeScript
55%
Other

Phase Console

Security · Devops

904

End-to-end encrypted secrets management for engineering teams — from local dev to Kubernetes production.

View details
84
Repo Health
73
Technical
67
Dependency
Built with
TypeScript55%
Python44%
Updated today
Python
91%
GPL 3.0

Weblate

Developer Tools

6,028

Continuous localization platform that commits translations directly into your version control system with full translator attribution.

View details
95
Repo Health
86
Technical
74
Dependency
Built with
Python91%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search