Expand description
Module for password hashing and verification. Use this if you need to store user passwords.
You can use this module to hash a password and validate it afterward. This is the recommended way to verify a user password on login.
The default algorithm (PasswordHashVersion::Latest) is Argon2id.
use devolutions_crypto::password_hash::{hash_password, PasswordHashVersion};
let password = b"somesuperstrongpa$$w0rd!";
let hashed_password = hash_password(password, PasswordHashVersion::Latest).expect("hash password shouldn't fail");
assert!(hashed_password.verify_password(b"somesuperstrongpa$$w0rd!"));
assert!(!hashed_password.verify_password(b"someweakpa$$w0rd!"));Re-exports§
pub use super::PasswordHashVersion;
Structs§
- Password
Hash - A versionned password hash. Can be used to validate a password without storing the password.
Functions§
- hash_
password - Creates a
PasswordHashcontaining the password verifier. - hash_
password_ with_ parameters - Creates a
PasswordHashusing caller-suppliedDerivationParameters.