pub trait PasswordVerifier<H>where
H: ?Sized,{
// Required method
fn verify_password(&self, password: &[u8], hash: &H) -> Result<(), Error>;
}Expand description
Trait for password verification.
Generic around a password hash to be returned (typically phc::PasswordHash).
Automatically impl’d for type that impl PasswordHasher with phc::PasswordHash as H.
This trait is object safe and can be used to implement abstractions over multiple password hashing algorithms.
Required Methods§
Sourcefn verify_password(&self, password: &[u8], hash: &H) -> Result<(), Error>
fn verify_password(&self, password: &[u8], hash: &H) -> Result<(), Error>
Compute this password hashing function against the provided password using the parameters from the provided password hash and see if the computed output matches.
§Errors
- Returns
Error::Algorithmif the algorithm requested by the hashHis unsupported - Returns
Error::PasswordInvalidif the computed hash for the supplied password does not match the expected hash - May return other algorithm-specific errors
Implementors§
impl PasswordVerifier<str> for Argon2<'_>
Available on crate features
alloc and password-hash only.impl<T> PasswordVerifier<PasswordHash> for Twhere
T: CustomizedPasswordHasher<PasswordHash>,
<T as CustomizedPasswordHasher<PasswordHash>>::Params: for<'a> TryFrom<&'a PasswordHash, Error = Error>,
Available on crate feature
phc only.