Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The following code example shows how to verify a password when stored using one
of many possible password hashing algorithms implemented in this repository.

```rust
use password_hash::{PasswordHash, PasswordVerifier};
use password_hash::{phc, PasswordVerifier};

use argon2::Argon2;
use pbkdf2::Pbkdf2;
Expand All @@ -35,10 +35,10 @@ use scrypt::Scrypt;
let hash_string = "$argon2i$v=19$m=65536,t=1,p=1$c29tZXNhbHQAAAAAAAAAAA$+r0d29hqEB0yasKr55ZgICsQGSkl0v0kgwhd+U3wyRo";
let input_password = "password";

let password_hash = PasswordHash::new(&hash_string).expect("invalid password hash");
let password_hash = phc::PasswordHash::new(&hash_string).expect("invalid password hash");

// Trait objects for algorithms to support
let algs: &[&dyn PasswordVerifier] = &[&Argon2::default(), &Pbkdf2, &Scrypt];
let algs: &[&dyn PasswordVerifier<phc::PasswordHash>] = &[&Argon2::default(), &Pbkdf2, &Scrypt];

password_hash.verify_password(algs, input_password).expect("invalid password");
```
Expand Down
4 changes: 2 additions & 2 deletions argon2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ impl<'key> Argon2<'key> {
}

#[cfg(all(feature = "alloc", feature = "password-hash"))]
impl CustomizedPasswordHasher for Argon2<'_> {
impl CustomizedPasswordHasher<PasswordHash> for Argon2<'_> {
type Params = Params;

fn hash_password_customized(
Expand Down Expand Up @@ -654,7 +654,7 @@ impl CustomizedPasswordHasher for Argon2<'_> {
}

#[cfg(all(feature = "alloc", feature = "password-hash"))]
impl PasswordHasher for Argon2<'_> {
impl PasswordHasher<PasswordHash> for Argon2<'_> {
fn hash_password(&self, password: &[u8], salt: &[u8]) -> password_hash::Result<PasswordHash> {
let salt = Salt::new(salt)?;

Expand Down
4 changes: 2 additions & 2 deletions balloon-hash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ where
}

#[cfg(all(feature = "alloc", feature = "password-hash"))]
impl<D> CustomizedPasswordHasher for Balloon<'_, D>
impl<D> CustomizedPasswordHasher<PasswordHash> for Balloon<'_, D>
where
D: Digest + FixedOutputReset,
Array<u8, D::OutputSize>: ArrayDecoding,
Expand Down Expand Up @@ -243,7 +243,7 @@ where
}

#[cfg(all(feature = "alloc", feature = "password-hash"))]
impl<D> PasswordHasher for Balloon<'_, D>
impl<D> PasswordHasher<PasswordHash> for Balloon<'_, D>
where
D: Digest + FixedOutputReset,
Array<u8, D::OutputSize>: ArrayDecoding,
Expand Down
2 changes: 1 addition & 1 deletion password-auth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fn generate_phc_hash(password: &[u8], salt: &[u8]) -> password_hash::Result<Pass
pub fn verify_password(password: impl AsRef<[u8]>, hash: &str) -> Result<(), VerifyError> {
let hash = PasswordHash::new(hash).map_err(ParseError::new)?;

let algs: &[&dyn PasswordVerifier] = &[
let algs: &[&dyn PasswordVerifier<PasswordHash>] = &[
#[cfg(feature = "argon2")]
&Argon2::default(),
#[cfg(feature = "pbkdf2")]
Expand Down
4 changes: 2 additions & 2 deletions pbkdf2/src/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use sha1::Sha1;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct Pbkdf2;

impl CustomizedPasswordHasher for Pbkdf2 {
impl CustomizedPasswordHasher<PasswordHash> for Pbkdf2 {
type Params = Params;

fn hash_password_customized(
Expand Down Expand Up @@ -65,7 +65,7 @@ impl CustomizedPasswordHasher for Pbkdf2 {
}
}

impl PasswordHasher for Pbkdf2 {
impl PasswordHasher<PasswordHash> for Pbkdf2 {
fn hash_password(&self, password: &[u8], salt: &[u8]) -> Result<PasswordHash> {
self.hash_password_customized(password, salt, None, None, Params::default())
}
Expand Down
4 changes: 2 additions & 2 deletions scrypt/src/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub const ALG_ID: Ident = Ident::new_unwrap(ALG_NAME);
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct Scrypt;

impl CustomizedPasswordHasher for Scrypt {
impl CustomizedPasswordHasher<PasswordHash> for Scrypt {
type Params = Params;

fn hash_password_customized(
Expand Down Expand Up @@ -68,7 +68,7 @@ impl CustomizedPasswordHasher for Scrypt {
}
}

impl PasswordHasher for Scrypt {
impl PasswordHasher<PasswordHash> for Scrypt {
fn hash_password(&self, password: &[u8], salt: &[u8]) -> Result<PasswordHash> {
self.hash_password_customized(password, salt, None, None, Params::default())
}
Expand Down