Crate djangohashers [−] [src]
A Rust port of the password primitives used in Django Project.
Django's django.contrib.auth.models.User
class has a few methods to deal with passwords,
like set_password()
and check_password()
; DjangoHashers implements the primitive
functions behind that methods. All Django's built-in hashers are supported.
This library was conceived for Django integration, but is not limited to it; you can use the password hash algorithm in any Rust project (or FFI integration), since its security model is already battle-tested.
Structs
Argon2Hasher |
Hasher that uses the Argon2 function (new in Django 1.10). |
BCryptHasher |
Hasher that uses the bcrypt key-derivation function without password padding. |
BCryptSHA256Hasher |
Hasher that uses the bcrypt key-derivation function with the password padded with SHA256. |
CryptHasher |
Hasher that uses the UNIX's crypt(3) hash function. |
Django |
Abstraction that exposes the functions that generates passwords compliant with different Django versions. |
MD5Hasher |
Hasher that uses the MD5 hashing function over the salted password. |
PBKDF2Hasher |
Hasher that uses the PBKDF2 key-derivation function with the SHA256 hashing algorithm. |
PBKDF2SHA1Hasher |
Hasher that uses the PBKDF2 key-derivation function with the SHA1 hashing algorithm. |
SHA1Hasher |
Hasher that uses the SHA1 hashing function over the salted password. |
UnsaltedMD5Hasher |
Hasher that uses the MD5 hashing function with no salting. |
UnsaltedSHA1Hasher |
Hasher that uses the SHA1 hashing function with no salting. |
VALID_SALT_RE |
Enums
Algorithm |
Algorithms available to use with Hashers. |
HasherError |
Possible errors during a hash creation. |
Version |
Django Version. |
Traits
Hasher |
Hasher abstraction, providing methods to encode and verify hashes. |
Functions
check_password |
Verifies a password against an encoded hash, returns a Result. |
check_password_tolerant |
Verifies a password against an encoded hash, returns a boolean, even in case of error. |
is_password_usable |
Verifies if an encoded hash is properly formatted before check it cryptographically. |
make_password |
Based on the current Django version, generates an encoded hash given only a password, uses a random salt and the PBKDF2 algorithm. |
make_password_core |
Core function that generates all combinations of passwords: |
make_password_with_algorithm |
Based on the current Django version, generates an encoded hash given a password and algorithm, uses a random salt. |
make_password_with_settings |
Based on the current Django version, generates an encoded hash given a complete set of parameters: password, salt and algorithm. |