Expand description
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§
- Argon2
Hasher - Hasher that uses the Argon2 function (new in Django 1.10).
- BCrypt
Hasher - Hasher that uses the bcrypt key-derivation function without password padding.
- BCryptSH
A256 Hasher - Hasher that uses the bcrypt key-derivation function with the password padded with SHA256.
- Crypt
Hasher - 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.
- PBKD
F2Hasher - Hasher that uses the PBKDF2 key-derivation function with the SHA256 hashing algorithm.
- PBKD
F2SH A1Hasher - Hasher that uses the PBKDF2 key-derivation function with the SHA1 hashing algorithm.
- SHA1
Hasher - Hasher that uses the SHA1 hashing function over the salted password.
- Scrypt
Hasher - Hasher that uses the Scrypt function (new in Django 4.0).
- UnsaltedM
D5Hasher - Hasher that uses the MD5 hashing function with no salting.
- UnsaltedSH
A1Hasher - Hasher that uses the SHA1 hashing function with no salting.
- VALID_
SALT_ RE
Enums§
- Algorithm
- Algorithms available to use with Hashers.
- Django
Version - Django Version.
- Hasher
Error - Possible errors during a hash creation.
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.