#36546: Deprecate django.utils.crypto.constant_time_compare()
-------------------------------------+-------------------------------------
     Reporter:  Tim Graham           |                    Owner:  (none)
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Utilities            |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by suhail vs):

 what about adding a warning in function constant_time_compare in file
 `django.utils.crypto.py`

 {{{
 import warnings
 from django.utils.deprecation import RemovedInNextVersionWarning

 def constant_time_compare(val1, val2):
     """Return True if the two strings are equal, False otherwise."""
     warnings.warn(
         "constant_time_compare(val1, val2) is deprecated and will be
 removed in Django 6.0. "
         "`import secrets` from python standard library, then run
 secrets.compare_digest(val1,val2) instead.",
         RemovedInNextVersionWarning,
         stacklevel=2
     )
     return secrets.compare_digest(force_bytes(val1), force_bytes(val2))
 }}}
 `
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36546#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/010701989ced0078-cddfc123-60cf-4368-becc-821bd12f8bb8-000000%40eu-central-1.amazonses.com.

Reply via email to