1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Increased the default PBKDF2 iterations for Django 6.0.

This commit is contained in:
Sarah Boyce 2024-12-13 10:30:54 +01:00
parent 38902223bc
commit ad07a407f8
3 changed files with 8 additions and 7 deletions

View File

@ -318,7 +318,7 @@ class PBKDF2PasswordHasher(BasePasswordHasher):
"""
algorithm = "pbkdf2_sha256"
iterations = 1_000_000
iterations = 1_200_000
digest = hashlib.sha256
def encode(self, password, salt, iterations=None):

View File

@ -51,7 +51,8 @@ Minor features
:mod:`django.contrib.auth`
~~~~~~~~~~~~~~~~~~~~~~~~~~
* ...
* The default iteration count for the PBKDF2 password hasher is increased from
1,000,000 to 1,200,000.
:mod:`django.contrib.contenttypes`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -84,8 +84,8 @@ class TestUtilsHashPass(SimpleTestCase):
encoded = make_password("lètmein", "seasalt", "pbkdf2_sha256")
self.assertEqual(
encoded,
"pbkdf2_sha256$1000000$"
"seasalt$r1uLUxoxpP2Ued/qxvmje7UH9PUJBkRrvf9gGPL7Cps=",
"pbkdf2_sha256$1200000$"
"seasalt$6sTlFi4QohxXLuZigqDIUNX8xG9NxrTmV8+flFQdBqE=",
)
self.assertTrue(is_password_usable(encoded))
self.assertTrue(check_password("lètmein", encoded))
@ -278,8 +278,8 @@ class TestUtilsHashPass(SimpleTestCase):
encoded = hasher.encode("lètmein", "seasalt2")
self.assertEqual(
encoded,
"pbkdf2_sha256$1000000$"
"seasalt2$egbhFghgsJVDo5Tpg/k9ZnfbySKQ1UQnBYXhR97a7sk=",
"pbkdf2_sha256$1200000$"
"seasalt2$hPlIUc6GqWsws6cZV1K8OuOARm1UrbZ3vLGFoHkH0ZI=",
)
self.assertTrue(hasher.verify("lètmein", encoded))
@ -287,7 +287,7 @@ class TestUtilsHashPass(SimpleTestCase):
hasher = PBKDF2SHA1PasswordHasher()
encoded = hasher.encode("lètmein", "seasalt2")
self.assertEqual(
encoded, "pbkdf2_sha1$1000000$seasalt2$3R9hvSAiAy5ARspAFy5GJ/2rjXo="
encoded, "pbkdf2_sha1$1200000$seasalt2$RGU4BAy93u+JDPtuMamdllndh+c="
)
self.assertTrue(hasher.verify("lètmein", encoded))