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<Version>,
params: Self::Params,
) -> Result<H>;
// Provided method
fn hash_password_with_params(
&self,
password: &[u8],
salt: &[u8],
params: Self::Params,
) -> Result<H> { ... }
}Expand description
Trait for password hashing functions which support customization.
Generic around a password hash to be returned (typically phc::PasswordHash).
Required Associated Types§
Required Methods§
Sourcefn hash_password_customized(
&self,
password: &[u8],
salt: &[u8],
algorithm: Option<&str>,
version: Option<Version>,
params: Self::Params,
) -> Result<H>
fn hash_password_customized( &self, password: &[u8], salt: &[u8], algorithm: Option<&str>, version: Option<Version>, params: Self::Params, ) -> Result<H>
Compute a password hash 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.
§Errors
These will vary by algorithm/implementation of this trait, but may be due to:
- length restrictions on the password and/or salt
- algorithm-specific params or internal error
Provided Methods§
Sourcefn hash_password_with_params(
&self,
password: &[u8],
salt: &[u8],
params: Self::Params,
) -> Result<H>
fn hash_password_with_params( &self, password: &[u8], salt: &[u8], params: Self::Params, ) -> Result<H>
Compute a password hash using customized parameters only, using the default algorithm and version.
§Errors
These will vary by algorithm/implementation of this trait, but may be due to:
- length restrictions on the password and/or salt
- algorithm-specific params or internal error