bcrypt (Python)

A Python library for secure password hashing using the bcrypt algorithm with an adjustable work factor

Library
PyPI
v5.0.0
1,508 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
74 /100 Good
Development Activity 88
Maintenance 48
Community 72
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
78 /100 Good
Architecture 78
Code Quality 80
Innovation 65
Learning Curve 90

bcrypt is the Python Cryptographic Authority’s implementation of the bcrypt password-hashing algorithm, exposing a small, purpose-built API (hashpw, checkpw, gensalt, kdf) for hashing and verifying passwords. Each hash embeds a randomly generated salt and a configurable logarithmic work factor (rounds), so verification is a single checkpw call and there is no separate salt-management step for callers to get wrong. As of 3.0.0 the core hashing routine is implemented in Rust (src/_bcrypt) rather than C, which the maintainers adopted for improved memory safety while keeping the same Python-facing API.

The library intentionally does one thing — bcrypt password hashing — rather than bundling multiple algorithms, and its README is explicit that depending on the use case, scrypt or argon2id may be preferable; bcrypt is offered as a well-understood, widely compatible baseline rather than the state of the art. It supports adjustable prefixes (2a/2b) for compatibility with other bcrypt implementations, enforces the algorithm’s 72-byte password limit by raising instead of silently truncating, and ships typed stubs (py.typed, .pyi) for static-analysis-friendly integration.

What You Get

  • hashpw(password, salt) / checkpw(password, hashed) for one-line password hashing and verification
  • gensalt(rounds=12) to generate a salt with a configurable, adjustable logarithmic work factor
  • A kdf() function implementing bcrypt_pbkdf, used by OpenSSH’s encrypted private key format
  • Prefix compatibility (2a/2b) for interoperating with other bcrypt implementations
  • A memory-safe Rust core (since 3.0.0) behind the same stable Python API
  • Typed stubs (py.typed) for static type checkers

Common Use Cases

  • Hashing and verifying user account passwords in web applications
  • Implementing OpenSSH-compatible key derivation via the kdf function
  • Migrating legacy systems off weaker hashing (e.g. plain MD5/SHA1) onto a salted, work-factor-tunable scheme
  • Providing the password-hashing backend for higher-level auth frameworks and ORM user models

Under The Hood

Architecture - The Python package (src/bcrypt/__init__.py) is a thin re-export layer over a compiled extension module _bcrypt, whose implementation lives in src/_bcrypt/src/lib.rs (a Rust crate built via setuptools-rust). All actual hashing, salt generation, and the bcrypt_pbkdf-based kdf function are implemented in Rust and exposed to Python through PyO3-style bindings, so the Python layer only handles imports, __all__, and version metadata. Tech Stack - Built with setuptools + setuptools-rust (build-backend setuptools.build_meta), targeting Python 3.9+ (including free-threaded builds) and PyPy 3, with a Cargo.toml/Cargo.lock pinning the Rust dependency graph; the minimum supported Rust version is documented as 1.74.0 in the README. Code Quality - Tests live in a single tests/test_bcrypt.py file exercising hashpw/checkpw/gensalt/kdf across prefixes, rounds, and edge cases like the 72-byte password limit; the small, focused test surface matches the library’s narrow scope, and noxfile.py drives CI across Python versions. API Design - The API is deliberately minimal — four top-level functions and no configuration objects or classes — which keeps the learning curve close to zero; the tradeoff is that anything beyond bcrypt itself (e.g. algorithm negotiation or upgrade paths) is left to the caller or a higher-level library.

Used by 16 apps in this directory

JavaScript
88%
GPL 3.0

Glass by Pickle

AI Assistants

7,604

A privacy-first desktop AI assistant that sees your screen, hears your meetings, and turns live context into structured summaries—without sending a single byte to the cloud.

View details
43
Repo Health
76
Technical
68
Dependency
Built with
JavaScript 88%
TypeScript 12%
Updated 12 months ago
TypeScript
51%
AGPL 3.0

Glean

Bookmarks Archiving · Knowledge Management

872

Self-hosted RSS reader and personal knowledge management tool with MCP server integration for AI assistant connectivity.

View details
73
Repo Health
75
Technical
70
Dependency
Built with
TypeScript 51%
Python 45%
Updated 2 days ago
Python
94%
Apache 2.0

knowhere

AI Development · AI Memory · Developer Tools

3,755

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

View details
83
Repo Health
75
Technical
66
Dependency
Built with
Python 94%
Updated yesterday
Python
71%
MIT

Langflow

AI Agents · AI Development

155,973

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
64
Dependency
Built with
Python 71%
TypeScript 21%
Updated yesterday
Python
58%
Apache 2.0

MLflow

AI Development · Monitoring

28,512

The open source AI engineering platform for debugging, evaluating, monitoring, and optimizing production LLMs and agents at scale.

View details
96
Repo Health
86
Technical
67
Dependency
Built with
Python 58%
TypeScript 35%
Updated yesterday
JavaScript
40%
MIT

NoteDiscovery

Knowledge Management · Note Taking · Productivity

2,846

A self-hosted markdown knowledge base with MCP-powered AI integration, graph views, LaTeX math, and built-in drawing — your notes stay on your server, forever.

View details
81
Repo Health
59
Technical
74
Dependency
Built with
JavaScript 40%
Python 32%
HTML 24%
Updated 2 days ago
Python
38%
Other

Open WebUI

AI Agents · AI Assistants

156,607

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

View details
92
Repo Health
75
Technical
66
Dependency
Built with
Python 38%
Svelte 35%
JavaScript 19%
Updated yesterday

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