diff --git a/Cargo.lock b/Cargo.lock index 0a934ab17..8c9931b70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -265,7 +265,7 @@ dependencies = [ "cipher 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "crypto-common 0.1.6", "digest 0.10.6", - "elliptic-curve 0.12.3", + "elliptic-curve 0.13.0-pre", "password-hash", "signature 2.0.0-rc.1", "universal-hash 0.5.0", @@ -777,7 +777,7 @@ dependencies = [ [[package]] name = "password-hash" -version = "0.4.2" +version = "0.5.0-pre" dependencies = [ "base64ct", "rand_core 0.6.4", diff --git a/crypto/Cargo.toml b/crypto/Cargo.toml index 753374165..1bef3c71d 100644 --- a/crypto/Cargo.toml +++ b/crypto/Cargo.toml @@ -21,8 +21,8 @@ crypto-common = { version = "0.1", default-features = false } aead = { version = "0.5", optional = true, path = "../aead" } cipher = { version = "0.4", optional = true } digest = { version = "0.10", optional = true, features = ["mac"] } -elliptic-curve = { version = "0.12", optional = true } # TODO(tarcieri): path = "../elliptic-curve" -password-hash = { version = "0.4", optional = true, path = "../password-hash" } +elliptic-curve = { version = "=0.13.0-pre", optional = true, path = "../elliptic-curve" } +password-hash = { version = "=0.5.0-pre", optional = true, path = "../password-hash" } signature = { version = "=2.0.0-rc.1", optional = true, default-features = false, path = "../signature" } universal-hash = { version = "0.5", optional = true, path = "../universal-hash" } diff --git a/password-hash/Cargo.toml b/password-hash/Cargo.toml index 9a0cc299d..a056eb6dc 100644 --- a/password-hash/Cargo.toml +++ b/password-hash/Cargo.toml @@ -5,7 +5,7 @@ Traits which describe the functionality of password hashing algorithms, as well as a `no_std`-friendly implementation of the PHC string format (a well-defined subset of the Modular Crypt Format a.k.a. MCF) """ -version = "0.4.2" +version = "0.5.0-pre" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/password-hash/src/lib.rs b/password-hash/src/lib.rs index f451fb0a8..fda38c994 100644 --- a/password-hash/src/lib.rs +++ b/password-hash/src/lib.rs @@ -203,7 +203,7 @@ impl<'a> PasswordHash<'a> { pub fn generate( phf: impl PasswordHasher, password: impl AsRef<[u8]>, - salt: &'a str, + salt: impl Into>, ) -> Result { phf.hash_password(password.as_ref(), salt) } diff --git a/password-hash/src/traits.rs b/password-hash/src/traits.rs index 61e04adda..4c9952e90 100644 --- a/password-hash/src/traits.rs +++ b/password-hash/src/traits.rs @@ -30,17 +30,12 @@ pub trait PasswordHasher { /// salt value. /// /// Uses the default recommended parameters for a given algorithm. - fn hash_password<'a, S>(&self, password: &[u8], salt: &'a S) -> Result> - where - S: AsRef + ?Sized, - { - self.hash_password_customized( - password, - None, - None, - Self::Params::default(), - Salt::try_from(salt.as_ref())?, - ) + fn hash_password<'a>( + &self, + password: &[u8], + salt: impl Into>, + ) -> Result> { + self.hash_password_customized(password, None, None, Self::Params::default(), salt) } } diff --git a/password-hash/tests/hashing.rs b/password-hash/tests/hashing.rs index ef30c71ac..73378440a 100644 --- a/password-hash/tests/hashing.rs +++ b/password-hash/tests/hashing.rs @@ -68,12 +68,12 @@ impl<'a> TryFrom for ParamsString { #[test] fn verify_password_hash() { let valid_password = "test password"; - let salt = "test-salt"; + let salt = Salt::new("test-salt").unwrap(); let hash = PasswordHash::generate(StubPasswordHasher, valid_password, salt).unwrap(); // Sanity tests for StubFunction impl above assert_eq!(hash.algorithm, ALG); - assert_eq!(hash.salt.unwrap().as_str(), salt); + assert_eq!(hash.salt.unwrap(), salt); // Tests for generic password verification logic assert_eq!(