Skip to main content

Modern password hashing for Python

Project description

pwdlib

Modern password hashing for Python

build codecov PyPI version Downloads

Subscribe


Documentation: https://frankie567.github.io/pwdlib/

Source Code: https://github.com/frankie567/pwdlib


Quickstart

pip install 'pwdlib[argon2]'
from pwdlib import PasswordHash

password_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. Unfortunately, it has not been very active recently and its maintenance status is under question. 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.

✅ Goals

  • Provide an easy-to-use wrapper to hash and verify passwords
  • 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 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:

hatch run test

Format the code

Execute the following command to apply linting and check typing:

hatch run lint

Publish a new version

You can bump the version, create a commit and associated tag with one command:

hatch version patch
hatch version minor
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:

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pwdlib-0.2.1.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

pwdlib-0.2.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file pwdlib-0.2.1.tar.gz.

File metadata

  • Download URL: pwdlib-0.2.1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for pwdlib-0.2.1.tar.gz
Algorithm Hash digest
SHA256 9a1d8a8fa09a2f7ebf208265e55d7d008103cbdc82b9e4902ffdd1ade91add5e
MD5 b8fb0bf31035296193fe40162802a02e
BLAKE2b-256 82a09daed437a6226f632a25d98d65d60ba02bdafa920c90dcb6454c611ead6c

See more details on using hashes here.

File details

Details for the file pwdlib-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pwdlib-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for pwdlib-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1823dc6f22eae472b540e889ecf57fd424051d6a4023ec0bcf7f0de2d9d7ef8c
MD5 f34cb46c36018d3dc20867621847ee8e
BLAKE2b-256 01f30dae5078a486f0fdf4d4a1121e103bc42694a9da9bea7b0f2c63f29cfbd3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page