Skip to main content

Dummy (plain text) password hashing for Django… for use in tests!

Speed up tests!

Cryptography is greedy. When you run tests, you usually do not care about password security, but you care about performances. Using dummy password hashing speeds up tests!

Install django-plainpasswordhasher with your favorite installer. Here is an example using pip:

pip install django-plainpasswordhasher

Then configure your test settings:

PASSWORD_HASHERS = ('django_plainpasswordhasher.PlainPasswordHasher', )

Except explicit password hashing tests

In most cases, using a dummy password hasher will do the job. But you may write some tests that require real password hashing. In such a case, let’s override settings!

from django.conf import global_settings  # Django default settings...
                                         # You may use your project's
                                         # default settings instead.
from django.test import TestCase
from django.test.utils import override_settings

@override_settings(PASSWORD_HASHERS=global_settings.PASSWORD_HASHERS)
class CryptographyTestCase(TestCase):
     """Tests that require real cryptography."""

Resources

References

Metadata

Release files for django-plainpasswordhasher 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-plainpasswordhasher 0.3
File Size Uploaded
django-plainpasswordhasher-0.3.zip 10.8 kB Details

Release files / django-plainpasswordhasher-0.3.zip

Download URL django-plainpasswordhasher-0.3.zip
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e5cd99074b735da6ecbcd71711404e5e953d4c6579fbc34732a094a9de6167e4
BLAKE2b-256 checksum
How to use checksums
2bb07bc9cae1e570144e907fa9e72e2dbe4ea9c9f7fb11d878e8a63ab86e33b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3 This release

1 release file

0.2

1 release file

0.2.dev0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page