{"id":24279,"library":"py-bcrypt","title":"py-bcrypt","description":"A minimal bcrypt password hashing and key derivation library for Python. Current version 0.4 is outdated and no longer maintained; most users should switch to bcrypt or passlib.","status":"abandoned","version":"0.4","language":"python","source_language":"en","source_url":"https://github.com/pyca/py-bcrypt","tags":["bcrypt","password","hashing","deprecated"],"install":[{"cmd":"pip install py-bcrypt","lang":"bash","label":"Install py-bcrypt"}],"dependencies":[],"imports":[{"note":"The correct import is just 'import bcrypt' after installing py-bcrypt. Common mistake is using a different module name.","wrong":"from pybcrypt import bcrypt","symbol":"bcrypt","correct":"import bcrypt"}],"quickstart":{"code":"import bcrypt\n\npassword = b\"my_password\"\nhashed = bcrypt.hashpw(password, bcrypt.gensalt())\nif bcrypt.checkpw(password, hashed):\n    print(\"Password matches\")","lang":"python","description":"Hash a password and verify it."},"warnings":[{"fix":"Replace py-bcrypt with 'bcrypt' (pip install bcrypt) and update imports accordingly.","message":"py-bcrypt is abandoned and not compatible with modern Python (3.x+). Use bcrypt or passlib instead.","severity":"deprecated","affected_versions":"all"},{"fix":"Switch to a C-extension based library like bcrypt.","message":"py-bcrypt is extremely slow compared to modern alternatives (e.g., bcrypt, argon2). It uses a pure Python implementation.","severity":"gotcha","affected_versions":"all"},{"fix":"Always use bytes: bcrypt.hashpw(password.encode(), bcrypt.gensalt()).","message":"The salt generation with gensalt() returns bytes; ensure you pass bytes to hashpw.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install with 'pip install py-bcrypt' and import as 'import bcrypt'.","cause":"The library is not installed or import name is wrong.","error":"ModuleNotFoundError: No module named 'bcrypt'"},{"fix":"Encode the string: bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt()).","cause":"Passing a string instead of bytes to bcrypt functions.","error":"TypeError: Unicode-objects must be encoded before hashing"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}