Permalink
Browse files

Increased the default PBKDF2 iterations for Django 2.1.

  • Loading branch information...
timgraham committed May 14, 2018
1 parent 31ce1f7 commit cae010728763e0e716b87f4ccd8b3fa54eb20602
Showing with 4 additions and 4 deletions.
  1. +1 −1 django/contrib/auth/hashers.py
  2. +3 −3 tests/auth_tests/test_hashers.py
@@ -236,7 +236,7 @@ class PBKDF2PasswordHasher(BasePasswordHasher):
safely but you must rename the algorithm if you change SHA256.
"""
algorithm = "pbkdf2_sha256"
- iterations = 100000
+ iterations = 120000
digest = hashlib.sha256
def encode(self, password, salt, iterations=None):
@@ -52,7 +52,7 @@ def test_simple(self):
def test_pbkdf2(self):
encoded = make_password('lètmein', 'seasalt', 'pbkdf2_sha256')
- self.assertEqual(encoded, 'pbkdf2_sha256$100000$seasalt$BNZ6eyaNc8qFTJPjrAq99hSYb73EgAdytAtdBg2Sdcc=')
+ self.assertEqual(encoded, 'pbkdf2_sha256$120000$seasalt$fsgWMpOXin7ZAmi4j+7XjKCZ4JCvxJTGiwwDrawRqSc=')
self.assertTrue(is_password_usable(encoded))
self.assertTrue(check_password('lètmein', encoded))
self.assertFalse(check_password('lètmeinz', encoded))
@@ -285,13 +285,13 @@ def test_is_password_usable(self):
def test_low_level_pbkdf2(self):
hasher = PBKDF2PasswordHasher()
encoded = hasher.encode('lètmein', 'seasalt2')
- self.assertEqual(encoded, 'pbkdf2_sha256$100000$seasalt2$Tl4GMr+Yt1zzO1sbKoUaDBdds5NkR3RxaDWuQsliFrI=')
+ self.assertEqual(encoded, 'pbkdf2_sha256$120000$seasalt2$FRWVLZaxRXtbVIkhYdTQc/tE7JF/s5tU/4O4VhB94ig=')
self.assertTrue(hasher.verify('lètmein', encoded))
def test_low_level_pbkdf2_sha1(self):
hasher = PBKDF2SHA1PasswordHasher()
encoded = hasher.encode('lètmein', 'seasalt2')
- self.assertEqual(encoded, 'pbkdf2_sha1$100000$seasalt2$dK/dL+ySBZ5zoR0+Zk3SB/VsH0U=')
+ self.assertEqual(encoded, 'pbkdf2_sha1$120000$seasalt2$6kIwMgg3rEEwDAQY/CB9VUVtEiI=')
self.assertTrue(hasher.verify('lètmein', encoded))
@override_settings(

0 comments on commit cae0107

Please sign in to comment.