Permalink
Browse files

Increased the default PBKDF2 iterations.

  • Loading branch information...
timgraham committed Jan 17, 2015
1 parent d468903 commit c51258882bbf388f5c4cfc379340097ebe9beda9
Showing with 8 additions and 5 deletions.
  1. +1 −1 django/contrib/auth/hashers.py
  2. +3 −3 django/contrib/auth/tests/test_hashers.py
  3. +4 −1 docs/releases/1.9.txt
@@ -226,7 +226,7 @@ class PBKDF2PasswordHasher(BasePasswordHasher):
safely but you must rename the algorithm if you change SHA256.
"""
algorithm = "pbkdf2_sha256"
iterations = 20000
iterations = 24000
digest = hashlib.sha256
def encode(self, password, salt, iterations=None):
@@ -46,7 +46,7 @@ def test_simple(self):
def test_pkbdf2(self):
encoded = make_password('lètmein', 'seasalt', 'pbkdf2_sha256')
self.assertEqual(encoded,
'pbkdf2_sha256$20000$seasalt$oBSd886ysm3AqYun62DOdin8YcfbU1z9cksZSuLP9r0=')
'pbkdf2_sha256$24000$seasalt$V9DfCAVoweeLwxC/L2mb+7swhzF0XYdyQMqmusZqiTc=')
self.assertTrue(is_password_usable(encoded))
self.assertTrue(check_password('lètmein', encoded))
self.assertFalse(check_password('lètmeinz', encoded))
@@ -210,14 +210,14 @@ def test_low_level_pkbdf2(self):
hasher = PBKDF2PasswordHasher()
encoded = hasher.encode('lètmein', 'seasalt2')
self.assertEqual(encoded,
'pbkdf2_sha256$20000$seasalt2$Flpve/uAcyo6+IFI6YAhjeABGPVbRQjzHDxRhqxewgw=')
'pbkdf2_sha256$24000$seasalt2$TUDkfilKHVC7BkaKSZgIKhm0aTtXlmcw/5C1FeS/DPk=')
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$20000$seasalt2$pJt86NmjAweBY1StBvxCu7l1o9o=')
'pbkdf2_sha1$24000$seasalt2$L37ETdd9trqrsJDwapU3P+2Edhg=')
self.assertTrue(hasher.verify('lètmein', encoded))
def test_upgrade(self):
View
@@ -38,7 +38,10 @@ Minor features
:mod:`django.contrib.auth`
^^^^^^^^^^^^^^^^^^^^^^^^^^
* ...
* The default iteration count for the PBKDF2 password hasher has been increased
by 20%. This backwards compatible change will not affect users who have
subclassed ``django.contrib.auth.hashers.PBKDF2PasswordHasher`` to change the
default value.
:mod:`django.contrib.gis`
^^^^^^^^^^^^^^^^^^^^^^^^^^

0 comments on commit c512588

Please sign in to comment.