#36226: Only PBKDF2PasswordHasher supports str and bytes password
------------------------------+------------------------------------
Reporter: Jason Held | Owner: (none)
Type: Bug | Status: new
Component: contrib.auth | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by Sarah Boyce):
* stage: Unreviewed => Accepted
Comment:
Replicated thank you! PRs welcome
{{{#!diff
--- a/tests/auth_tests/test_hashers.py
+++ b/tests/auth_tests/test_hashers.py
@@ -520,6 +520,19 @@ class TestUtilsHashPass(SimpleTestCase):
with self.assertRaisesMessage(ValueError, msg):
hasher.encode("password", salt)
+ def test_password_bytes(self):
+ hasher_classes = [
+ MD5PasswordHasher,
+ PBKDF2PasswordHasher,
+ PBKDF2SHA1PasswordHasher,
+ ScryptPasswordHasher,
+ ]
+ for hasher_class in hasher_classes:
+ hasher = hasher_class()
+ with self.subTest(hasher_class.__name__):
+ encoded = hasher.encode(b"password", hasher.salt())
+ self.assertTrue(hasher.verify(b"password", encoded))
+
def test_encode_password_required(self):
hasher_classes = [
MD5PasswordHasher,
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36226#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/010701955ff5dda0-244e68fd-522b-4b05-8cdb-7a208d64051d-000000%40eu-central-1.amazonses.com.