mirror of https://github.com/django/django.git
Increased the default PBKDF2 iterations for the 1.11 release cycle.
This commit is contained in:
parent
f847308200
commit
0bf3228eec
|
@ -247,7 +247,7 @@ class PBKDF2PasswordHasher(BasePasswordHasher):
|
||||||
safely but you must rename the algorithm if you change SHA256.
|
safely but you must rename the algorithm if you change SHA256.
|
||||||
"""
|
"""
|
||||||
algorithm = "pbkdf2_sha256"
|
algorithm = "pbkdf2_sha256"
|
||||||
iterations = 36000
|
iterations = 100000
|
||||||
digest = hashlib.sha256
|
digest = hashlib.sha256
|
||||||
|
|
||||||
def encode(self, password, salt, iterations=None):
|
def encode(self, password, salt, iterations=None):
|
||||||
|
|
|
@ -51,7 +51,8 @@ Minor features
|
||||||
:mod:`django.contrib.auth`
|
:mod:`django.contrib.auth`
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
* ...
|
* The default iteration count for the PBKDF2 password hasher is increased from
|
||||||
|
36,000 to 100,000.
|
||||||
|
|
||||||
:mod:`django.contrib.contenttypes`
|
:mod:`django.contrib.contenttypes`
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
|
@ -56,7 +56,7 @@ class TestUtilsHashPass(SimpleTestCase):
|
||||||
|
|
||||||
def test_pbkdf2(self):
|
def test_pbkdf2(self):
|
||||||
encoded = make_password('lètmein', 'seasalt', 'pbkdf2_sha256')
|
encoded = make_password('lètmein', 'seasalt', 'pbkdf2_sha256')
|
||||||
self.assertEqual(encoded, 'pbkdf2_sha256$36000$seasalt$mEUPPFJkT/xtwDU8rB7Q+puHRZnR07WRjerTkt/3HI0=')
|
self.assertEqual(encoded, 'pbkdf2_sha256$100000$seasalt$BNZ6eyaNc8qFTJPjrAq99hSYb73EgAdytAtdBg2Sdcc=')
|
||||||
self.assertTrue(is_password_usable(encoded))
|
self.assertTrue(is_password_usable(encoded))
|
||||||
self.assertTrue(check_password('lètmein', encoded))
|
self.assertTrue(check_password('lètmein', encoded))
|
||||||
self.assertFalse(check_password('lètmeinz', encoded))
|
self.assertFalse(check_password('lètmeinz', encoded))
|
||||||
|
@ -280,13 +280,13 @@ class TestUtilsHashPass(SimpleTestCase):
|
||||||
def test_low_level_pbkdf2(self):
|
def test_low_level_pbkdf2(self):
|
||||||
hasher = PBKDF2PasswordHasher()
|
hasher = PBKDF2PasswordHasher()
|
||||||
encoded = hasher.encode('lètmein', 'seasalt2')
|
encoded = hasher.encode('lètmein', 'seasalt2')
|
||||||
self.assertEqual(encoded, 'pbkdf2_sha256$36000$seasalt2$QkIBVCvGmTmyjPJ5yox2y/jQB8isvgUNK98FxOU1UYo=')
|
self.assertEqual(encoded, 'pbkdf2_sha256$100000$seasalt2$Tl4GMr+Yt1zzO1sbKoUaDBdds5NkR3RxaDWuQsliFrI=')
|
||||||
self.assertTrue(hasher.verify('lètmein', encoded))
|
self.assertTrue(hasher.verify('lètmein', encoded))
|
||||||
|
|
||||||
def test_low_level_pbkdf2_sha1(self):
|
def test_low_level_pbkdf2_sha1(self):
|
||||||
hasher = PBKDF2SHA1PasswordHasher()
|
hasher = PBKDF2SHA1PasswordHasher()
|
||||||
encoded = hasher.encode('lètmein', 'seasalt2')
|
encoded = hasher.encode('lètmein', 'seasalt2')
|
||||||
self.assertEqual(encoded, 'pbkdf2_sha1$36000$seasalt2$GoU+9AubJ/xRkO0WD1Xf3WPxWfE=')
|
self.assertEqual(encoded, 'pbkdf2_sha1$100000$seasalt2$dK/dL+ySBZ5zoR0+Zk3SB/VsH0U=')
|
||||||
self.assertTrue(hasher.verify('lètmein', encoded))
|
self.assertTrue(hasher.verify('lètmein', encoded))
|
||||||
|
|
||||||
@override_settings(
|
@override_settings(
|
||||||
|
|
Loading…
Reference in New Issue