mirror of
https://github.com/django/django.git
synced 2024-11-28 21:43:13 +01:00
Increased the default PBKDF2 iterations for Django 4.2.
This commit is contained in:
parent
cdb2f7f36c
commit
3c6f1fd1f8
@ -296,7 +296,7 @@ class PBKDF2PasswordHasher(BasePasswordHasher):
|
||||
"""
|
||||
|
||||
algorithm = "pbkdf2_sha256"
|
||||
iterations = 390000
|
||||
iterations = 480000
|
||||
digest = hashlib.sha256
|
||||
|
||||
def encode(self, password, salt, iterations=None):
|
||||
|
@ -42,7 +42,8 @@ Minor features
|
||||
:mod:`django.contrib.auth`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* ...
|
||||
* The default iteration count for the PBKDF2 password hasher is increased from
|
||||
390,000 to 480,000.
|
||||
|
||||
:mod:`django.contrib.contenttypes`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -77,7 +77,7 @@ class TestUtilsHashPass(SimpleTestCase):
|
||||
encoded = make_password("lètmein", "seasalt", "pbkdf2_sha256")
|
||||
self.assertEqual(
|
||||
encoded,
|
||||
"pbkdf2_sha256$390000$seasalt$8xBlGd3jVgvJ+92hWPxi5ww0uuAuAnKgC45eudxro7c=",
|
||||
"pbkdf2_sha256$480000$seasalt$G4ja8YRtfnNyEx4Ii2pbFMp/l8s4nnbMdJ+Fob/qNK8=",
|
||||
)
|
||||
self.assertTrue(is_password_usable(encoded))
|
||||
self.assertTrue(check_password("lètmein", encoded))
|
||||
@ -404,8 +404,8 @@ class TestUtilsHashPass(SimpleTestCase):
|
||||
encoded = hasher.encode("lètmein", "seasalt2")
|
||||
self.assertEqual(
|
||||
encoded,
|
||||
"pbkdf2_sha256$390000$seasalt2$geC/uZ92nRXDSjSxeoiBqYyRcrLzMm8xK3r"
|
||||
"o1QS1uo8=",
|
||||
"pbkdf2_sha256$480000$seasalt2$WlORJKPl5w3Lubr7rYLOwSQCEOm4Or/NCA"
|
||||
"aECnB1PE0=",
|
||||
)
|
||||
self.assertTrue(hasher.verify("lètmein", encoded))
|
||||
|
||||
@ -413,7 +413,7 @@ class TestUtilsHashPass(SimpleTestCase):
|
||||
hasher = PBKDF2SHA1PasswordHasher()
|
||||
encoded = hasher.encode("lètmein", "seasalt2")
|
||||
self.assertEqual(
|
||||
encoded, "pbkdf2_sha1$390000$seasalt2$aDapRanzW8aHTz97v2TcfHzWD+I="
|
||||
encoded, "pbkdf2_sha1$480000$seasalt2$qyT+EkK5g82hk2r+fRecFeoe28E="
|
||||
)
|
||||
self.assertTrue(hasher.verify("lètmein", encoded))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user