Name | django-plaintext-password JSON |
Version |
0.3.0
JSON |
| download |
home_page | None |
Summary | A Django password hasher to store passwords in plaintext. |
upload_time | 2024-10-31 09:58:12 |
maintainer | None |
docs_url | None |
author | Jake Howard |
requires_python | >=3.9 |
license | MIT License Copyright (c) 2020 Jake Howard Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# django-plaintext-password
![CI](https://github.com/RealOrangeOne/django-plaintext-password/workflows/CI/badge.svg)
![PyPI](https://img.shields.io/pypi/v/django-plaintext-password.svg)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-plaintext-password.svg)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/django-plaintext-password.svg)
![PyPI - Status](https://img.shields.io/pypi/status/django-plaintext-password.svg)
![PyPI - License](https://img.shields.io/pypi/l/django-plaintext-password.svg)
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`](https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-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`](https://docs.python.org/3/library/secrets.html#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](https://theorangeone.net/posts/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.
Raw data
{
"_id": null,
"home_page": null,
"name": "django-plaintext-password",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Jake Howard",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/de/8b/d2fdbd23ceb46a157f10efce7c2beb9b79c9033069b512fb3ddf1fcd3b32/django_plaintext_password-0.3.0.tar.gz",
"platform": null,
"description": "# django-plaintext-password\n\n![CI](https://github.com/RealOrangeOne/django-plaintext-password/workflows/CI/badge.svg)\n![PyPI](https://img.shields.io/pypi/v/django-plaintext-password.svg)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-plaintext-password.svg)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/django-plaintext-password.svg)\n![PyPI - Status](https://img.shields.io/pypi/status/django-plaintext-password.svg)\n![PyPI - License](https://img.shields.io/pypi/l/django-plaintext-password.svg)\n\nA Django password hasher to store passwords in plaintext.\n\nThis hasher is over 100000x faster than Django's default hasher, and around 20x faster than the MD5-based hasher.\n\n## Installation and usage\n\n```\npip install django-plaintext-password\n```\n\nThen add `plaintext_password.PlaintextPasswordHasher` to [`PASSWORD_HASHERS`](https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-PASSWORD_HASHERS) in `settings.py`. To ensure it's used by default, make it the first or only item.\n\n## How does it work?\n\nBy default, Django will store the password `password123` in a format similar to:\n\n```\npbkdf2_sha256$216000$gd57n4OWJrXh$Xs/TqhwJICOxsLONGlKXorjuWccooiuJmJOUaxbwcOQ=\n```\n\nThis 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:\n\n```\nplaintext$$password123\n```\n\nThis makes searching by password possible, as well as comparing users passwords and allowing you to email users their passwords if they forget them - neat!\n\nIn addition to storing the values directly in the database for easy retrieval, the comparison is done simply with `==`, rather than using [`secrets.compare_digest`](https://docs.python.org/3/library/secrets.html#secrets.compare_digest).\n\n## _\"Should I use this in production?\"_\n\nOh 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.\n\nFor more on why using this in production is a terrible idea, check out [How to store passwords](https://theorangeone.net/posts/how-to-store-passwords/).\n\nWhen running deployment checks, this will throw a \"CRITICAL\" error if in use.\n\n## Why?\n\nWell, why not?\n\nAlthough 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.\n\nUnfortunately 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.\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2020 Jake Howard Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "A Django password hasher to store passwords in plaintext.",
"version": "0.3.0",
"project_urls": {
"Changelog": "https://github.com/RealOrangeOne/django-plaintext-password/releases",
"Issues": "https://github.com/RealOrangeOne/django-plaintext-password/issues",
"Source": "https://github.com/RealOrangeOne/django-plaintext-password"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "08a3fa7424be91d54ad59e547984fd7174548c01afa5f059ab9a1e4a9363e778",
"md5": "d0345dc157ec0c9cf6c2378008fcd466",
"sha256": "e8de99210ca7954953ff702747b94dba0066567462b185d4ef6bd2cfda3c2d36"
},
"downloads": -1,
"filename": "django_plaintext_password-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d0345dc157ec0c9cf6c2378008fcd466",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 5454,
"upload_time": "2024-10-31T09:58:11",
"upload_time_iso_8601": "2024-10-31T09:58:11.572736Z",
"url": "https://files.pythonhosted.org/packages/08/a3/fa7424be91d54ad59e547984fd7174548c01afa5f059ab9a1e4a9363e778/django_plaintext_password-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "de8bd2fdbd23ceb46a157f10efce7c2beb9b79c9033069b512fb3ddf1fcd3b32",
"md5": "46f9f91a875318f5c085b06fc6f35f5f",
"sha256": "4f7eafd75c9e0d69a031dfcd6da6c1ddd2e483e6699960330329196ce49ab0cb"
},
"downloads": -1,
"filename": "django_plaintext_password-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "46f9f91a875318f5c085b06fc6f35f5f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 4871,
"upload_time": "2024-10-31T09:58:12",
"upload_time_iso_8601": "2024-10-31T09:58:12.514469Z",
"url": "https://files.pythonhosted.org/packages/de/8b/d2fdbd23ceb46a157f10efce7c2beb9b79c9033069b512fb3ddf1fcd3b32/django_plaintext_password-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-31 09:58:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "RealOrangeOne",
"github_project": "django-plaintext-password",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "django-plaintext-password"
}