Trait password_hash::PasswordHasher
source · pub trait PasswordHasher {
type Params: Clone + Debug + Default + for<'a> TryFrom<&'a PasswordHash<'a>, Error = Error> + TryInto<ParamsString, Error = Error>;
// Required method
fn hash_password_customized<'a>(
&self,
password: &[u8],
algorithm: Option<Ident<'a>>,
version: Option<Decimal>,
params: Self::Params,
salt: impl Into<Salt<'a>>,
) -> Result<PasswordHash<'a>>;
// Provided method
fn hash_password<'a>(
&self,
password: &[u8],
salt: impl Into<Salt<'a>>,
) -> Result<PasswordHash<'a>> { ... }
}
Expand description
Trait for password hashing functions.
Required Associated Types§
Required Methods§
sourcefn hash_password_customized<'a>(
&self,
password: &[u8],
algorithm: Option<Ident<'a>>,
version: Option<Decimal>,
params: Self::Params,
salt: impl Into<Salt<'a>>,
) -> Result<PasswordHash<'a>>
fn hash_password_customized<'a>( &self, password: &[u8], algorithm: Option<Ident<'a>>, version: Option<Decimal>, params: Self::Params, salt: impl Into<Salt<'a>>, ) -> Result<PasswordHash<'a>>
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§
sourcefn hash_password<'a>(
&self,
password: &[u8],
salt: impl Into<Salt<'a>>,
) -> Result<PasswordHash<'a>>
fn hash_password<'a>( &self, password: &[u8], salt: impl Into<Salt<'a>>, ) -> Result<PasswordHash<'a>>
Simple API for computing a PasswordHash
from a password and
salt value.
Uses the default recommended parameters for a given algorithm.
Object Safety§
This trait is not object safe.