Trait argon2::PasswordHasher
source · [−]pub trait PasswordHasher {
type Params: Clone + Debug + Default + for<'a> TryFrom<&'a PasswordHash<'a>> + TryInto<ParamsString>
where
<Self::Params as TryFrom<&'a PasswordHash<'a>>>::Error == Error,
<Self::Params as TryInto<ParamsString>>::Error == Error;
fn hash_password_customized<'a>(
&self,
password: &[u8],
algorithm: Option<Ident<'a>>,
version: Option<u32>,
params: Self::Params,
salt: impl Into<Salt<'a>>
) -> Result<PasswordHash<'a>, Error>;
fn hash_password<S>(
&self,
password: &[u8],
salt: &'a S
) -> Result<PasswordHash<'a>, Error>
where
S: AsRef<str> + ?Sized,
{ ... }
}
Available on crate feature
password-hash
only.Expand description
Trait for password hashing functions.
Required Associated Types
type Params: Clone + Debug + Default + for<'a> TryFrom<&'a PasswordHash<'a>> + TryInto<ParamsString>
where
<Self::Params as TryFrom<&'a PasswordHash<'a>>>::Error == Error,
<Self::Params as TryInto<ParamsString>>::Error == Error
type Params: Clone + Debug + Default + for<'a> TryFrom<&'a PasswordHash<'a>> + TryInto<ParamsString>
where
<Self::Params as TryFrom<&'a PasswordHash<'a>>>::Error == Error,
<Self::Params as TryInto<ParamsString>>::Error == Error
Algorithm-specific parameters.
Required Methods
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
fn hash_password<S>(
&self,
password: &[u8],
salt: &'a S
) -> Result<PasswordHash<'a>, Error> where
S: AsRef<str> + ?Sized,
fn hash_password<S>(
&self,
password: &[u8],
salt: &'a S
) -> Result<PasswordHash<'a>, Error> where
S: AsRef<str> + ?Sized,
Simple API for computing a PasswordHash
from a password and
salt value.
Uses the default recommended parameters for a given algorithm.
Implementors
sourceimpl PasswordHasher for Argon2<'_>
Available on crate feature alloc
only.
impl PasswordHasher for Argon2<'_>
Available on crate feature
alloc
only.