Opened 10 years ago

Closed 9 years ago

#3604 closed (fixed)

Use hashlib if running under Python 2.5

Reported by: Rob Hudson <treborhudson@…> Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: hashlib, sha1, md5, sprintsept14
Cc: treborhudson@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

Description

This was discussed here:
http://groups.google.com/group/django-developers/browse_thread/thread/d5f0951f47889770/4cb8257b8d4d8c28

Python 2.5 has deprecated the use of the sha1 and md5 modules in favor of the hashlib module. A patch will be following that implements django.contrib.auth.models methods using hashlib.

Attachments (1)

hashlib.diff (2.7 KB) - added by Rob Hudson <treborhudson@…> 10 years ago.

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by Rob Hudson <treborhudson@…>

Attachment: hashlib.diff added

comment:1 Changed 10 years ago by Rob Hudson <treborhudson@…>

Cc: treborhudson@… added
Has patch: set
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

comment:2 Changed 10 years ago by Simon G. <dev@…>

Keywords: hashlib sha1 md5 added
Triage Stage: UnreviewedAccepted

comment:3 Changed 9 years ago by Fredrik Lundh <fredrik@…>

Keywords: sprintsept14 added
Triage Stage: AcceptedReady for checkin

Possible change: instead of doing

    try:
        # Python 2.5 has moved to using hashlib for hashing functions
        import hashlib
        ... use hashlib
    except ImportError:
        ... use old libraries

do

    try:
        # Python 2.5 has moved to using hashlib for hashing functions
        import hashlib
    except ImportError:
        # Fallback
        ... use old libraries ...
    else:
        ... use hashlib ...

Also, this test lacks explicit tests, but I think the functionality should be covered by other existing tests.

comment:4 Changed 9 years ago by Adrian Holovaty

Patch needs improvement: set

I'm working on checking this in.

comment:5 Changed 9 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [6318]) Fixed #3604 -- django.contrib.auth password checking now uses hashlib if it's available. Thanks, Rob Hudson

Note: See TracTickets for help on using tickets.
Back to Top