Password hashing library, rewrite of passlib.
Project description
libpass-next
Libpass is a rewrite of passlib library
Installation
pip install libpass-next
Usage
You can use individual hashers (argon2, bcrypt, pbkdf2, etc) individually:
from libpass.hashers.bcrypt import BcryptHasher
hasher = BcryptHasher()
hash = hasher.hash("password")
print(f"{hash=}")
is_valid = hasher.verify(hash=hash, secret="password")
print(f"{is_valid=}")
Or you can combine them into a single CryptContext if you
need to support multiple password hashing schemes:
from libpass.context import CryptContext
from libpass.hashers.argon2 import Argon2Hasher
from libpass.hashers.bcrypt import BcryptHasher
context = CryptContext(
schemes=[
Argon2Hasher(),
BcryptHasher(),
]
)
hash = context.hash("password")
# $argon2id$v=19$m=65536,t=3,p=4$cIRqyLJEF2IBc0ggxp4Kqw$W+PxOyErga7uHi/BOkyTsT6atZAfFuc1GEPwHOwyJMM
print(f"{hash=}")
is_valid = context.verify(hash=hash, secret="password")
print(f"{is_valid=}") # True
old_hash = "$2b$12$eNeQerKdKhGj3IfERBdGPem7wUtlW3szwawvT5GIm/UNKxCuDnZku"
print(context.verify(hash=old_hash, secret="password")) # True
print(context.needs_update(old_hash)) # True
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
libpass_next-0.3.0.tar.gz
(15.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file libpass_next-0.3.0.tar.gz.
File metadata
- Download URL: libpass_next-0.3.0.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
477363d887d8737fec7202b5b71617bad4f7e5f19e672e74dffca3acd8ffbc37
|
|
| MD5 |
0ce91abe9d6f97fbdc847831e1909d1e
|
|
| BLAKE2b-256 |
1fac05a541f73e4a244e7d5cb4997ddd2b7800ff0f2b805519b4029cb3007d84
|
File details
Details for the file libpass_next-0.3.0-py3-none-any.whl.
File metadata
- Download URL: libpass_next-0.3.0-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
787813bd99462115b86a17e7ba427a9c8f066347c7027d9f06d4f78f67bd0fa0
|
|
| MD5 |
dd55107a809e295ed5bb48e17edd2fb5
|
|
| BLAKE2b-256 |
dd3327d1b1d6245dcd75f390c1460ee7ebbf68d79dc07829a546276108336e8b
|