Re: [Django] #37078: Change default algorithm of salted_hmac() from SHA-1 to SHA-256

11 views
Skip to first unread message

Django

unread,
Apr 30, 2026, 10:17:48 AMApr 30
to django-...@googlegroups.com
#37078: Change default algorithm of salted_hmac() from SHA-1 to SHA-256
--------------------------------------+------------------------------------
Reporter: Denny Biasiolli | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Utilities | Version: dev
Severity: Normal | Resolution:
Keywords: security, crypto | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Denny Biasiolli):

I'd be happy to help, but do you have suggestions about the steps I need
to take to fix this?
My PR with the fix (without the deprecation) was here:
https://github.com/django/django/pull/21190
--
Ticket URL: <https://code.djangoproject.com/ticket/37078#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 30, 2026, 10:32:51 AMApr 30
to django-...@googlegroups.com
#37078: Change default algorithm of salted_hmac() from SHA-1 to SHA-256
--------------------------------------+------------------------------------
Reporter: Denny Biasiolli | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Utilities | Version: dev
Severity: Normal | Resolution:
Keywords: security, crypto | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Jacob Walls):

Sure thing, and thanks for the offer.

1. Set yourself in the owner field here on this ticket.
2. Check the [https://docs.djangoproject.com/en/dev/internals/contributing
/writing-code/submitting-patches/#deprecating-a-feature deprecation guide]
for places to add documentation.
3. I assume you will need to do something like change the default value
for the argument to a `NOT_PROVIDED` sentinel, check for it, and issue the
warning and fall back to SHA-1.
--
Ticket URL: <https://code.djangoproject.com/ticket/37078#comment:7>

Django

unread,
Apr 30, 2026, 11:05:00 AMApr 30
to django-...@googlegroups.com
#37078: Change default algorithm of salted_hmac() from SHA-1 to SHA-256
-------------------------------------+-------------------------------------
Reporter: Denny Biasiolli | Owner: Denny
Type: | Biasiolli
Cleanup/optimization | Status: assigned
Component: Utilities | Version: dev
Severity: Normal | Resolution:
Keywords: security, crypto | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Denny Biasiolli):

* owner: (none) => Denny Biasiolli
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/37078#comment:8>

Django

unread,
Apr 30, 2026, 1:53:22 PMApr 30
to django-...@googlegroups.com
#37078: Change default algorithm of salted_hmac() from SHA-1 to SHA-256
-------------------------------------+-------------------------------------
Reporter: Denny Biasiolli | Owner: Denny
Type: | Biasiolli
Cleanup/optimization | Status: assigned
Component: Utilities | Version: dev
Severity: Normal | Resolution:
Keywords: security, crypto | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Denny Biasiolli):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/37078#comment:9>

Django

unread,
May 4, 2026, 11:10:40 AMMay 4
to django-...@googlegroups.com
#37078: Change default algorithm of salted_hmac() from SHA-1 to SHA-256
-------------------------------------+-------------------------------------
Reporter: Denny Biasiolli | Owner: Denny
Type: | Biasiolli
Cleanup/optimization | Status: assigned
Component: Utilities | Version: dev
Severity: Normal | Resolution:
Keywords: security, crypto | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/37078#comment:10>

Django

unread,
May 4, 2026, 1:45:27 PMMay 4
to django-...@googlegroups.com
#37078: Change default algorithm of salted_hmac() from SHA-1 to SHA-256
-------------------------------------+-------------------------------------
Reporter: Denny Biasiolli | Owner: Denny
Type: | Biasiolli
Cleanup/optimization | Status: closed
Component: Utilities | Version: dev
Severity: Normal | Resolution: fixed
Keywords: security, crypto | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls <jacobtylerwalls@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"0f4fff79d33b7cc84822e66bd1fc16caf8222e3a" 0f4fff79]:
{{{#!CommitTicketReference repository=""
revision="0f4fff79d33b7cc84822e66bd1fc16caf8222e3a"
Fixed #37078 -- Deprecated SHA-1 default for salted_hmac() and
base64_hmac() algorithm.

Deprecated the default value of the algorithm argument in
django.utils.crypto.salted_hmac() and django.core.signing.base64_hmac(),
which will change from 'sha1' to 'sha256' in Django 7.0.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/37078#comment:11>
Reply all
Reply to author
Forward
0 new messages