Skip to content

Commit 67781ec

Browse files
committed
password-hash: change bounds for PHC verify blanket impl [BREAKING]
Changes the `TryFrom` bound for constructing `T::Params` to accept a full `phc::PasswordHash` as the input type, rather than just its `phc::ParamsString`. This is actually how it used to work in prior releases, but regressed: https://docs.rs/password-hash/0.5.0/src/password_hash/traits.rs.html#63 This is needed so the params can include the output size for the hash. This is unfortunately a breaking change, but fortunately we haven't yet released any password hash crates, so it will only impact prerelease users.
1 parent f18bb80 commit 67781ec

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

password-hash/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ pub trait PasswordVerifier<H: ?Sized> {
196196
#[cfg(feature = "phc")]
197197
impl<T: CustomizedPasswordHasher<phc::PasswordHash>> PasswordVerifier<phc::PasswordHash> for T
198198
where
199-
T::Params: for<'a> TryFrom<&'a phc::ParamsString, Error = Error>,
199+
T::Params: for<'a> TryFrom<&'a phc::PasswordHash, Error = Error>,
200200
{
201201
fn verify_password(&self, password: &[u8], hash: &phc::PasswordHash) -> Result<()> {
202202
#[allow(clippy::single_match)]
@@ -207,7 +207,7 @@ where
207207
salt,
208208
Some(hash.algorithm.as_str()),
209209
hash.version,
210-
T::Params::try_from(&hash.params)?,
210+
T::Params::try_from(hash)?,
211211
)?;
212212

213213
if let Some(computed_output) = &computed_hash.hash {

0 commit comments

Comments
 (0)