Ticket #6028: md5-crypt.diff

File md5-crypt.diff, 709 bytes (added by Antti Kaihola, 17 years ago)

use "crypt" as name for both DES and MD5 crypt algorithms and detect MD5 by examining the salt

  • django/contrib/auth/models.py

     
    5151    Returns a boolean of whether the raw_password was correct. Handles
    5252    encryption formats behind the scenes.
    5353    """
    54     algo, salt, hsh = enc_password.split('$')
     54    algo, salt_and_hash = enc_password.split('$', 1)
     55    if algo == 'crypt' and salt_and_hash.startswith('$1'):
     56        salt = hsh = salt_and_hash
     57    else:
     58        salt, hsh = salt_and_hash.rsplit('$', 1)
    5559    return hsh == get_hexdigest(algo, salt, raw_password)
    5660
    5761class SiteProfileNotAvailable(Exception):
Back to Top