Fixed #35428 -- Increased parallelism of the ScryptPasswordHasher.

This commit is contained in:
SaJH 2024-05-12 03:32:57 +09:00 committed by Sarah Boyce
parent 50852b2c2c
commit 8f205acea9
3 changed files with 6 additions and 3 deletions

View File

@ -570,7 +570,7 @@ class ScryptPasswordHasher(BasePasswordHasher):
algorithm = "scrypt"
block_size = 8
maxmem = 0
parallelism = 1
parallelism = 5
work_factor = 2**14
def encode(self, password, salt, n=None, r=None, p=None):

View File

@ -46,6 +46,9 @@ Minor features
* The default iteration count for the PBKDF2 password hasher is increased from
720,000 to 870,000.
* In order to follow OWASP recommendations, the default ``parallelism`` of the
``ScryptPasswordHasher`` is increased from 1 to 5.
* :class:`~django.contrib.auth.forms.BaseUserCreationForm` and
:class:`~django.contrib.auth.forms.AdminPasswordChangeForm` now support
disabling password-based authentication by setting an unusable password on

View File

@ -650,8 +650,8 @@ class TestUtilsHashPassScrypt(SimpleTestCase):
encoded = make_password("lètmein", "seasalt", "scrypt")
self.assertEqual(
encoded,
"scrypt$16384$seasalt$8$1$Qj3+9PPyRjSJIebHnG81TMjsqtaIGxNQG/aEB/NY"
"afTJ7tibgfYz71m0ldQESkXFRkdVCBhhY8mx7rQwite/Pw==",
"scrypt$16384$seasalt$8$5$ECMIUp+LMxMSK8xB/IVyba+KYGTI7FTnet025q/1f"
"/vBAVnnP3hdYqJuRi+mJn6ji6ze3Fbb7JEFPKGpuEf5vw==",
)
self.assertIs(is_password_usable(encoded), True)
self.assertIs(check_password("lètmein", encoded), True)