Django

Code

Changeset 5073

Show
Ignore:
Timestamp:
04/25/07 04:34:29 (1 year ago)
Author:
mtredinnick
Message:

Fixed #3316 -- Added support for crypt hashing of passwords, mostly to support
easy porting from existing Unix-based legacy apps. Thanks, axiak@mit.edu.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r5071 r5073  
    5050    David Ascher <http://ascher.ca/> 
    5151    Arthur <avandorp@gmail.com> 
     52    axiak@mit.edu 
    5253    Jiri Barton 
    5354    Ned Batchelder <http://www.nedbatchelder.com/> 
  • django/trunk/django/contrib/auth/models.py

    r5061 r5073  
    1818        import sha 
    1919        return hsh == sha.new(salt+raw_password).hexdigest() 
     20    elif algo == 'crypt': 
     21        try: 
     22            import crypt 
     23        except ImportError: 
     24            raise ValueError, "Crypt password algorithm not supported in this environment." 
     25        return hsh == crypt.crypt(raw_password, salt) 
    2026    raise ValueError, "Got unknown password algorithm type in password." 
    2127 
  • django/trunk/docs/authentication.txt

    r5072 r5073  
    205205That's hashtype, salt and hash, separated by the dollar-sign character. 
    206206 
    207 Hashtype is either ``sha1`` (default) or ``md5`` -- the algorithm used to 
    208 perform a one-way hash of the password. Salt is a random string used to salt 
    209 the raw password to create the hash. 
     207Hashtype is either ``sha1`` (default), ``md5`` or ``crypt`` -- the algorithm 
     208used to perform a one-way hash of the password. Salt is a random string used 
     209to salt the raw password to create the hash. Note that the ``crypt`` method is 
     210only supported on platforms that have the standard Python ``crypt`` module 
     211available. 
    210212 
    211213For example::