[][src]Function devolutions_crypto::password_hash::hash_password

pub fn hash_password(
    password: &[u8],
    iterations: u32,
    version: PasswordHashVersion
) -> PasswordHash

Creates a PasswordHash containing the password verifier.

Arguments

  • password - The password to hash.
  • iterations - The number of iterations of the password hash. A higher number is slower but harder to brute-force. The recommended is 10000, but the number can be set by the user.
  • version - Version of the library to hash the password with. Use PasswordHashVersion::Latest if you're not dealing with shared data.

Returns

Returns the PasswordHash containing the password verifier.

Example

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

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

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