[][src]Module devolutions_crypto::password_hash

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.

use devolutions_crypto::password_hash::{hash_password, PasswordHashVersion};

let password = b"somesuperstrongpa$$w0rd!";

let hashed_password = hash_password(password, 10000, PasswordHashVersion::Latest);

assert!(hashed_password.verify_password(b"somesuperstrongpa$$w0rd!"));
assert!(!hashed_password.verify_password(b"someweakpa$$w0rd!"));

Structs

PasswordHash

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

Enums

PasswordHashVersion

The versions of the password hashing scheme to use.

Functions

hash_password

Creates a PasswordHash containing the password verifier.