CustomizedPasswordHasher

Trait CustomizedPasswordHasher 

Source
pub trait CustomizedPasswordHasher<H> {
    type Params: Clone + Debug + Default;

    // Required method
    fn hash_password_customized(
        &self,
        password: &[u8],
        salt: &[u8],
        algorithm: Option<&str>,
        version: Option<u32>,
        params: Self::Params,
    ) -> Result<H, Error>;

    // Provided method
    fn hash_password_with_params(
        &self,
        password: &[u8],
        salt: &[u8],
        params: Self::Params,
    ) -> Result<H, Error> { ... }
}
Available on crate feature password-hash only.
Expand description

Trait for password hashing functions which support customization.

Generic around a password hash to be returned (typically [PasswordHash])

Required Associated Types§

Source

type Params: Clone + Debug + Default

Algorithm-specific parameters.

Required Methods§

Source

fn hash_password_customized( &self, password: &[u8], salt: &[u8], algorithm: Option<&str>, version: Option<u32>, params: Self::Params, ) -> Result<H, Error>

Compute a [PasswordHash] from the provided password using an explicit set of customized algorithm parameters as opposed to the defaults.

When in doubt, use PasswordHasher::hash_password instead.

Provided Methods§

Source

fn hash_password_with_params( &self, password: &[u8], salt: &[u8], params: Self::Params, ) -> Result<H, Error>

Compute a [PasswordHash] using customized parameters only, using the default algorithm and version.

Implementors§