Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frankie567/pwdlib
Modern password hashing for Python
https://github.com/frankie567/pwdlib
hashing hashing-passwords password web
Last synced: 17 days ago
JSON representation
Modern password hashing for Python
- Host: GitHub
- URL: https://github.com/frankie567/pwdlib
- Owner: frankie567
- License: mit
- Created: 2024-02-10T08:43:32.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-08-19T06:47:53.000Z (3 months ago)
- Last Synced: 2024-09-20T10:48:20.647Z (about 2 months ago)
- Topics: hashing, hashing-passwords, password, web
- Language: Python
- Homepage: https://frankie567.github.io/pwdlib/
- Size: 55.7 KB
- Stars: 46
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# pwdlib
Modern password hashing for Python[![build](https://github.com/frankie567/pwdlib/workflows/Build/badge.svg)](https://github.com/frankie567/pwdlib/actions)
[![codecov](https://codecov.io/gh/frankie567/pwdlib/branch/main/graph/badge.svg)](https://codecov.io/gh/frankie567/pwdlib)
[![PyPI version](https://badge.fury.io/py/pwdlib.svg)](https://badge.fury.io/py/pwdlib)
[![Downloads](https://pepy.tech/badge/pwdlib)](https://pepy.tech/project/pwdlib)
---
**Documentation**: https://frankie567.github.io/pwdlib/
**Source Code**: https://github.com/frankie567/pwdlib
---
## Quickstart
```sh
pip install 'pwdlib[argon2]'
``````py
from pwdlib import PasswordHashpassword_hash = PasswordHash.recommended()
hash = password_hash.hash("herminetincture")
password_hash.verify("herminetincture", hash) # True
```## Why `pwdlib`?
For years, the de-facto standard to hash passwords was [`passlib`](https://foss.heptapod.net/python-libs/passlib). Unfortunately, it has not been very active recently and its [maintenance status is under question](https://foss.heptapod.net/python-libs/passlib/-/issues/187). Starting Python 3.13, `passlib` won't work anymore.
That's why I decided to start `pwdlib`, a password hash helper for the modern Python era. However, it's **not designed to be a complete replacement** for `passlib`, which supports numerous [hashing algorithms and features](https://passlib.readthedocs.io/en/stable/lib/index.html).
**✅ Goals**
- [x] Provide an easy-to-use wrapper to hash and verify passwords
- [x] Support modern and secure algorithms like Argon2 or Bcrypt**❌ Non-goals**
- [ ] Support legacy hashing algorithms like MD5
- [ ] Implement algorithms directly — we should only rely on existing and battle-tested implementations## Development
### Setup environment
We use [Hatch](https://hatch.pypa.io/latest/install/) to manage the development environment and production build. Ensure it's installed on your system.
### Run unit tests
You can run all the tests with:
```bash
hatch run test
```### Format the code
Execute the following command to apply linting and check typing:
```bash
hatch run lint
```### Publish a new version
You can bump the version, create a commit and associated tag with one command:
```bash
hatch version patch
``````bash
hatch version minor
``````bash
hatch version major
```Your default Git text editor will open so you can add information about the release.
When you push the tag on GitHub, the workflow will automatically publish it on PyPi and a GitHub release will be created as draft.
## Serve the documentation
You can serve the Mkdocs documentation with:
```bash
hatch run docs-serve
```It'll automatically watch for changes in your code.
## License
This project is licensed under the terms of the MIT license.