Skip to main content

Module password_hash

Module password_hash 

Source
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§

PasswordHash
A versionned password hash. Can be used to validate a password without storing the password.

Functions§

hash_password
Creates a PasswordHash containing the password verifier.
hash_password_with_parameters
Creates a PasswordHash using caller-supplied DerivationParameters.