django-plaintext-password
A Django password hasher to store passwords in plaintext.
This hasher is over 100000x faster than Django's default hasher, and around 20x faster than the MD5-based hasher.
Installation and usage
pip install django-plaintext-password
Then add plaintext_password.PlaintextPasswordHasher to PASSWORD_HASHERS in settings.py. To ensure it's used by default, make it the first or only item.
How does it work?
By default, Django will store the password password123 in a format similar to:
pbkdf2_sha256$216000$gd57n4OWJrXh$Xs/TqhwJICOxsLONGlKXorjuWccooiuJmJOUaxbwcOQ=
This is good for security as the password has been both salted and hashed before being saved into the database, making it almost impossible to retrieve the original password. This library however, stores the password as-is:
plaintext$$password123
This makes searching by password possible, as well as comparing users passwords and allowing you to email users their passwords if they forget them - neat!
In addition to storing the values directly in the database for easy retrieval, the comparison is done simply with ==, rather than using secrets.compare_digest.
"Should I use this in production?"
Oh definitely not. Storing passwords in plaintext is a very very bad thing. Django's defaults are incredibly secure and should be used unless you have a good reason not to.
For more on why using this in production is a terrible idea, check out How to store passwords.
When running deployment checks, this will throw a "CRITICAL" error if in use.
Why?
Well, why not?
Although in all seriousness, If as part of your tests you're creating a large number of users, or just a couple users but you've got a lot of tests, you can get quite a performance improvement by simplifying the password hasher.
Unfortunately due to a limitation (and feature) with Django, it's not possible to store just the value directly, it must be prefixed with the algorithm.
Metadata
Release files for django-plaintext-password 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_plaintext_password-0.3.0.tar.gz | 4.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_plaintext_password-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.3 kB
Release files / django_plaintext_password-0.3.0.tar.gz
| Download URL | django_plaintext_password-0.3.0.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f7eafd75c9e0d69a031dfcd6da6c1ddd2e483e6699960330329196ce49ab0cb
|
|
BLAKE2b-256 checksum How to use checksums |
de8bd2fdbd23ceb46a157f10efce7c2beb9b79c9033069b512fb3ddf1fcd3b32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.10
|
Release files / django_plaintext_password-0.3.0-py3-none-any.whl
| Download URL | django_plaintext_password-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e8de99210ca7954953ff702747b94dba0066567462b185d4ef6bd2cfda3c2d36
|
|
BLAKE2b-256 checksum How to use checksums |
08a3fa7424be91d54ad59e547984fd7174548c01afa5f059ab9a1e4a9363e778
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.10
|
Security for django-plaintext-password 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.