summaryrefslogtreecommitdiff
path: root/django/utils/crypto.py
diff options
context:
space:
mode:
authorДилян Палаузов <Dilyan.Palauzov@db.com>2018-01-03 18:52:12 -0500
committerTim Graham <timograham@gmail.com>2018-01-03 20:12:23 -0500
commitd7b2aa24f75434c2ce50100cfef3586071e0747a (patch)
tree9074eb7522888e744f948c52174f367a4281c200 /django/utils/crypto.py
parentc2d0f8c084456b5073252a91eeb09ab3d7453b18 (diff)
Fixed #28982 -- Simplified code with and/or.
Diffstat (limited to 'django/utils/crypto.py')
-rw-r--r--django/utils/crypto.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/django/utils/crypto.py b/django/utils/crypto.py
index f6f44856d0..61d02b65cf 100644
--- a/django/utils/crypto.py
+++ b/django/utils/crypto.py
@@ -78,8 +78,7 @@ def pbkdf2(password, salt, iterations, dklen=0, digest=None):
"""Return the hash of password using pbkdf2."""
if digest is None:
digest = hashlib.sha256
- if not dklen:
- dklen = None
+ dklen = dklen or None
password = force_bytes(password)
salt = force_bytes(salt)
return hashlib.pbkdf2_hmac(digest().name, password, salt, iterations, dklen)