class BasePasswordHasher: (source)
Known subclasses: django.contrib.auth.hashers.Argon2PasswordHasher
, django.contrib.auth.hashers.BCryptSHA256PasswordHasher
, django.contrib.auth.hashers.CryptPasswordHasher
, django.contrib.auth.hashers.MD5PasswordHasher
, django.contrib.auth.hashers.PBKDF2PasswordHasher
, django.contrib.auth.hashers.ScryptPasswordHasher
, django.contrib.auth.hashers.SHA1PasswordHasher
, django.contrib.auth.hashers.UnsaltedMD5PasswordHasher
, django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher
Abstract base class for password hashers When creating your own hasher, you need to override algorithm, verify(), encode() and safe_summary(). PasswordHasher objects are immutable.
Method | decode |
Return a decoded database value. |
Method | encode |
Create an encoded database value. |
Method | harden |
Bridge the runtime gap between the work factor supplied in `encoded` and the work factor suggested by this hasher. |
Method | must |
Undocumented |
Method | safe |
Return a summary of safe values. |
Method | salt |
Generate a cryptographically secure nonce salt in ASCII with an entropy of at least `salt_entropy` bits. |
Method | verify |
Check if the given password is correct. |
Class Variable | algorithm |
Undocumented |
Class Variable | library |
Undocumented |
Class Variable | salt |
Undocumented |
Method | _check |
Undocumented |
Method | _load |
Undocumented |
django.contrib.auth.hashers.Argon2PasswordHasher
, django.contrib.auth.hashers.BCryptSHA256PasswordHasher
, django.contrib.auth.hashers.CryptPasswordHasher
, django.contrib.auth.hashers.MD5PasswordHasher
, django.contrib.auth.hashers.PBKDF2PasswordHasher
, django.contrib.auth.hashers.ScryptPasswordHasher
, django.contrib.auth.hashers.SHA1PasswordHasher
, django.contrib.auth.hashers.UnsaltedMD5PasswordHasher
, django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher
Return a decoded database value. The result is a dictionary and should contain `algorithm`, `hash`, and `salt`. Extra keys can be algorithm specific like `iterations` or `work_factor`.
django.contrib.auth.hashers.Argon2PasswordHasher
, django.contrib.auth.hashers.BCryptSHA256PasswordHasher
, django.contrib.auth.hashers.CryptPasswordHasher
, django.contrib.auth.hashers.MD5PasswordHasher
, django.contrib.auth.hashers.PBKDF2PasswordHasher
, django.contrib.auth.hashers.ScryptPasswordHasher
, django.contrib.auth.hashers.SHA1PasswordHasher
, django.contrib.auth.hashers.UnsaltedMD5PasswordHasher
, django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher
Create an encoded database value. The result is normally formatted as "algorithm$salt$hash" and must be fewer than 128 characters.
django.contrib.auth.hashers.Argon2PasswordHasher
, django.contrib.auth.hashers.BCryptSHA256PasswordHasher
, django.contrib.auth.hashers.CryptPasswordHasher
, django.contrib.auth.hashers.MD5PasswordHasher
, django.contrib.auth.hashers.PBKDF2PasswordHasher
, django.contrib.auth.hashers.ScryptPasswordHasher
, django.contrib.auth.hashers.SHA1PasswordHasher
, django.contrib.auth.hashers.UnsaltedMD5PasswordHasher
, django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher
Bridge the runtime gap between the work factor supplied in `encoded` and the work factor suggested by this hasher. Taking PBKDF2 as an example, if `encoded` contains 20000 iterations and `self.iterations` is 30000, this method should run password through another 10000 iterations of PBKDF2. Similar approaches should exist for any hasher that has a work factor. If not, this method should be defined as a no-op to silence the warning.
django.contrib.auth.hashers.Argon2PasswordHasher
, django.contrib.auth.hashers.BCryptSHA256PasswordHasher
, django.contrib.auth.hashers.MD5PasswordHasher
, django.contrib.auth.hashers.PBKDF2PasswordHasher
, django.contrib.auth.hashers.ScryptPasswordHasher
, django.contrib.auth.hashers.SHA1PasswordHasher
Undocumented
django.contrib.auth.hashers.Argon2PasswordHasher
, django.contrib.auth.hashers.BCryptSHA256PasswordHasher
, django.contrib.auth.hashers.CryptPasswordHasher
, django.contrib.auth.hashers.MD5PasswordHasher
, django.contrib.auth.hashers.PBKDF2PasswordHasher
, django.contrib.auth.hashers.ScryptPasswordHasher
, django.contrib.auth.hashers.SHA1PasswordHasher
, django.contrib.auth.hashers.UnsaltedMD5PasswordHasher
, django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher
Return a summary of safe values. The result is a dictionary and will be used where the password field must be displayed to construct a safe representation of the password.
django.contrib.auth.hashers.BCryptSHA256PasswordHasher
, django.contrib.auth.hashers.CryptPasswordHasher
, django.contrib.auth.hashers.UnsaltedMD5PasswordHasher
, django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher
Generate a cryptographically secure nonce salt in ASCII with an entropy of at least `salt_entropy` bits.
django.contrib.auth.hashers.Argon2PasswordHasher
, django.contrib.auth.hashers.BCryptSHA256PasswordHasher
, django.contrib.auth.hashers.CryptPasswordHasher
, django.contrib.auth.hashers.MD5PasswordHasher
, django.contrib.auth.hashers.PBKDF2PasswordHasher
, django.contrib.auth.hashers.ScryptPasswordHasher
, django.contrib.auth.hashers.SHA1PasswordHasher
, django.contrib.auth.hashers.UnsaltedMD5PasswordHasher
, django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher
Check if the given password is correct.
django.contrib.auth.hashers.Argon2PasswordHasher
, django.contrib.auth.hashers.BCryptSHA256PasswordHasher
, django.contrib.auth.hashers.CryptPasswordHasher
, django.contrib.auth.hashers.MD5PasswordHasher
, django.contrib.auth.hashers.PBKDF2PasswordHasher
, django.contrib.auth.hashers.ScryptPasswordHasher
, django.contrib.auth.hashers.SHA1PasswordHasher
, django.contrib.auth.hashers.UnsaltedMD5PasswordHasher
, django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher
Undocumented