diff options
Diffstat (limited to 'django/utils/crypto.py')
| -rw-r--r-- | django/utils/crypto.py | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/django/utils/crypto.py b/django/utils/crypto.py index b6145709c3..4b8146695a 100644 --- a/django/utils/crypto.py +++ b/django/utils/crypto.py @@ -5,10 +5,8 @@ Django's standard crypto functions and utilities. import hashlib import hmac import secrets -import warnings from django.conf import settings -from django.utils.deprecation import RemovedInDjango70Warning from django.utils.encoding import force_bytes @@ -66,12 +64,7 @@ def get_random_string(length, allowed_chars=RANDOM_STRING_CHARS): def constant_time_compare(val1, val2): """Return True if the two strings are equal, False otherwise.""" - warnings.warn( - "constant_time_compare() is deprecated. Use hmac.compare_digest() instead.", - RemovedInDjango70Warning, - stacklevel=2, - ) - return hmac.compare_digest(val1, val2) + return secrets.compare_digest(force_bytes(val1), force_bytes(val2)) def pbkdf2(password, salt, iterations, dklen=0, digest=None): |
