diff --git a/django/contrib/auth/hashers.py b/django/contrib/auth/hashers.py
index 5824685..769ba32 100644
a
|
b
|
def check_password(password, encoded, setter=None, preferred='default'):
|
37 | 37 | |
38 | 38 | if len(encoded) == 32 and '$' not in encoded: |
39 | 39 | hasher = get_hasher('unsalted_md5') |
| 40 | elif len(encoded) == 37 and encoded.startswith('md5$$'): |
| 41 | hasher = get_hasher('unsalted_md5') |
| 42 | encoded = encoded[5:] |
40 | 43 | else: |
41 | 44 | algorithm = encoded.split('$', 1)[0] |
42 | 45 | hasher = get_hasher(algorithm) |
diff --git a/django/contrib/auth/tests/hashers.py b/django/contrib/auth/tests/hashers.py
index 8a11511..c0adb3b 100644
a
|
b
|
class TestUtilsHashPass(unittest.TestCase):
|
59 | 59 | self.assertTrue(is_password_usable(encoded)) |
60 | 60 | self.assertTrue(check_password(u'letmein', encoded)) |
61 | 61 | self.assertFalse(check_password('letmeinz', encoded)) |
| 62 | # Alternate unsalted syntax |
| 63 | alt_encoded = "md5$$%s" % encoded |
| 64 | self.assertTrue(is_password_usable(alt_encoded)) |
| 65 | self.assertTrue(check_password(u'letmein', alt_encoded)) |
| 66 | self.assertFalse(check_password('letmeinz', alt_encoded)) |
62 | 67 | |
63 | 68 | @skipUnless(crypt, "no crypt module to generate password.") |
64 | 69 | def test_crypt(self): |