bcrypt
Modern password hashing for your software and your servers
This package has a good security score with no known vulnerabilities.
Community Reviews
Rock-solid password hashing with predictable performance characteristics
The biggest operational consideration is that bcrypt is intentionally CPU-intensive, which is the point. At rounds=12 (a reasonable default), expect ~300ms per hash on modest hardware. This blocks the thread, so you need to architect accordingly - either use async executors or accept the blocking behavior. We run hashing operations in thread pools to avoid blocking web workers. Memory usage is negligible and consistent.
Error handling is minimal but adequate - you'll mainly deal with ValueError for invalid salts or data. The library uses C bindings under the hood (via cffi), so installation occasionally hits issues on exotic platforms, but wheels are available for common environments. No connection pooling concerns since it's purely computational. Logging is absent, but the operations are atomic enough that you just wrap calls with your own instrumentation.
Best for: Applications needing battle-tested password hashing with predictable performance where you can architect around blocking operations.
Avoid if: You need non-blocking async operations without thread pools or require sub-100ms response times on password operations.
Rock-solid password hashing with minimal API, but lacks modern Python features
Error handling is reasonable but not great. Pass the wrong types and you'll get C extension errors that aren't always intuitive. The distinction between bytes and strings trips up newcomers regularly—you must encode strings to bytes before hashing, and the library won't guide you through this. Documentation is sparse but adequate for the simple API surface.
In production, it's been utterly reliable. The performance is excellent, and the security track record speaks for itself. IDE autocomplete works for function names but won't help with parameter types or return values. For a security-critical library, I wish it had better type annotations and more helpful error messages for common mistakes.
Best for: Projects needing reliable, industry-standard password hashing where the simple API and proven security matter more than modern Python ergonomics.
Avoid if: You require comprehensive type safety and rich IDE support, or prefer libraries with extensive documentation and examples.
Solid, battle-tested hashing with predictable performance characteristics
The work factor (cost parameter) gives you direct control over hashing time, typically 10-12 for production use. Critical gotcha: each hash operation blocks for 250-500ms at cost=12, so you absolutely must run this in thread pools or async executors to avoid blocking your event loop. We run it in a ProcessPoolExecutor for API endpoints to prevent one slow hash from cascading.
Error handling is straightforward - invalid salts raise clear exceptions, and the library doesn't silently fail. One annoyance is the bytes vs string handling; you're constantly encoding/decoding UTF-8. The C bindings mean installation can occasionally fail in restricted environments without build tools, though wheels cover most platforms now. No built-in rate limiting or memory-hard alternatives, so you're on your own for DoS protection.
Best for: Standard password hashing in web applications where you can offload to worker threads and need proven, audited cryptography.
Avoid if: You need async-native password hashing or memory-hard algorithms like Argon2 for maximum resistance to hardware attacks.
Sign in to write a review
Sign In