Opened 18 years ago

Closed 17 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: dev
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: no UI/UX: no

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@…> 18 years ago.

Download all attachments as: .zip

Change History (6)

by Rob Hudson <treborhudson@…>, 18 years ago

Attachment: hashlib.diff added

comment:1 by Rob Hudson <treborhudson@…>, 18 years ago

Cc: treborhudson@… added
Has patch: set

comment:2 by Simon G. <dev@…>, 18 years ago

Keywords: hashlib sha1 md5 added
Triage Stage: UnreviewedAccepted

comment:3 by Fredrik Lundh <fredrik@…>, 17 years ago

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 by Adrian Holovaty, 17 years ago

Patch needs improvement: set

I'm working on checking this in.

comment:5 by Adrian Holovaty, 17 years ago

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