Skip to content

Commit b282b45

Browse files
committed
Bump password-hash to v0.6.0-rc.2
This upgrades `rand_core` to v0.10 prereleases and depends directly on `getrandom` for access to the system RNG. It additionally bumps other crates like `digest` and `blake2` which use the new `crypto-common` with an upgraded `rand_core`. This required restoring some functionality in `blake2` which was used by `argon2`: RustCrypto/hashes#754 This is currently referenced as a git branch until we decide if this is a permanent solution for `argon2` or not, so as to unblock the upgrade.
1 parent 59760ef commit b282b45

File tree

16 files changed

+81
-93
lines changed

16 files changed

+81
-93
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
/target/
2-
/.readme/target/
3-
/benches/target/
2+
**/target/
43
**/Cargo.lock

Cargo.lock

Lines changed: 28 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ exclude = ["benches", "fuzz"]
1515

1616
[profile.dev]
1717
opt-level = 2
18+
19+
[patch.crates-io.blake2]
20+
git = "https://github.com/RustCrypto/hashes"
21+
branch = "blake2/restore-blake-var"

argon2/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ password-hash = { version = "0.6.0-rc.1", features = ["rand_core"] }
3535
[features]
3636
default = ["alloc", "password-hash", "rand"]
3737
alloc = ["password-hash?/alloc"]
38-
std = ["alloc", "password-hash?/os_rng", "base64ct/std"]
38+
std = ["alloc", "base64ct/std"]
3939

40+
getrandom = ["simple", "password-hash/getrandom"]
4041
parallel = ["dep:rayon"]
4142
rand = ["password-hash?/rand_core"]
4243
simple = ["password-hash"]

argon2/src/blake2b_long.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{Error, Result};
44

55
use blake2::{
66
Blake2b512, Blake2bVar,
7-
digest::{self, Digest, VariableOutput},
7+
digest::{self, Digest},
88
};
99

1010
use core::convert::TryFrom;

argon2/src/lib.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,12 @@
3939
)]
4040
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
4141
//! use argon2::{
42-
//! password_hash::{
43-
//! // `OsRng` requires enabled `std` crate feature
44-
//! rand_core::OsRng,
45-
//! PasswordHash, PasswordHasher, PasswordVerifier, SaltString
46-
//! },
42+
//! password_hash::{PasswordHash, PasswordHasher, PasswordVerifier, SaltString},
4743
//! Argon2
4844
//! };
4945
//!
5046
//! let password = b"hunter42"; // Bad password; don't actually use!
51-
//! let salt = SaltString::try_from_rng(&mut OsRng).unwrap();
47+
//! let salt = SaltString::generate(); // Note: needs the `getrandom` feature of `argon2` enabled
5248
//!
5349
//! // Argon2 with default params (Argon2id v19)
5450
//! let argon2 = Argon2::default();
@@ -77,16 +73,12 @@
7773
)]
7874
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
7975
//! use argon2::{
80-
//! password_hash::{
81-
//! // `OsRng` requires enabled `std` crate feature
82-
//! rand_core::OsRng,
83-
//! PasswordHash, PasswordHasher, PasswordVerifier, SaltString
84-
//! },
76+
//! password_hash::{PasswordHash, PasswordHasher, PasswordVerifier, SaltString },
8577
//! Algorithm, Argon2, Params, Version
8678
//! };
8779
//!
8880
//! let password = b"hunter42"; // Bad password; don't actually use!
89-
//! let salt = SaltString::try_from_rng(&mut OsRng).unwrap();
81+
//! let salt = SaltString::generate(); // Note: needs the `getrandom` feature of `argon2` enabled
9082
//!
9183
//! // Argon2 with default params (Argon2id v19) and pepper
9284
//! let argon2 = Argon2::new_with_secret(

balloon-hash/Cargo.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,27 @@ edition = "2024"
1414
rust-version = "1.85"
1515

1616
[dependencies]
17-
digest = { version = "0.11.0-rc.1", default-features = false }
18-
crypto-bigint = { version = "0.7.0-rc.4", default-features = false, features = ["hybrid-array"] }
19-
rand_core = { version = "0.9", default-features = false }
17+
digest = { version = "0.11.0-rc.4", default-features = false }
18+
crypto-bigint = { version = "0.7.0-rc.9", default-features = false, features = ["hybrid-array"] }
19+
rand_core = { version = "0.10.0-rc-2", default-features = false }
2020

2121
# optional dependencies
22-
password-hash = { version = "0.6.0-rc.0", default-features = false, optional = true }
22+
password-hash = { version = "0.6.0-rc.2", default-features = false, optional = true }
2323
rayon = { version = "1.7", optional = true }
2424
zeroize = { version = "1", default-features = false, optional = true }
2525

2626
[dev-dependencies]
2727
hex-literal = "1"
28-
sha2 = "0.11.0-rc.2"
28+
sha2 = "0.11.0-rc.3"
2929

3030
[features]
3131
default = ["alloc", "password-hash", "rand"]
3232
alloc = ["password-hash/alloc"]
33+
std = ["alloc", "getrandom"]
34+
35+
getrandom = ["password-hash/getrandom"]
3336
parallel = ["rayon", "std"]
3437
rand = ["password-hash/rand_core"]
35-
std = ["alloc", "password-hash/os_rng", "rand_core/std"]
3638
zeroize = ["dep:zeroize"]
3739

3840
[package.metadata.docs.rs]

balloon-hash/src/lib.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,14 @@
3030
//!
3131
//! ```
3232
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
33-
//! # #[cfg(all(feature = "password-hash", feature = "std"))]
34-
//! # {
3533
//! use balloon_hash::{
36-
//! password_hash::{
37-
//! rand_core::OsRng,
38-
//! PasswordHash, PasswordHasher, PasswordVerifier, SaltString
39-
//! },
34+
//! password_hash::{PasswordHash, PasswordHasher, PasswordVerifier, SaltString},
4035
//! Balloon
4136
//! };
4237
//! use sha2::Sha256;
4338
//!
4439
//! let password = b"hunter42"; // Bad password; don't actually use!
45-
//! let salt = SaltString::try_from_rng(&mut OsRng)?;
40+
//! let salt = SaltString::generate(); // Note: needs the `getrandom` feature of `balloon-hash` enabled
4641
//!
4742
//! // Balloon with default params
4843
//! let balloon = Balloon::<Sha256>::default();
@@ -53,7 +48,6 @@
5348
//! // Verify password against PHC string
5449
//! let parsed_hash = PasswordHash::new(&password_hash)?;
5550
//! assert!(balloon.verify_password(password, &parsed_hash).is_ok());
56-
//! # }
5751
//! # Ok(())
5852
//! # }
5953
//! ```

bcrypt-pbkdf/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ edition = "2024"
1414
rust-version = "1.85"
1515

1616
[dependencies]
17-
blowfish = { version = "0.10.0-rc.1", features = ["bcrypt"] }
17+
blowfish = { version = "0.10.0-rc.2", features = ["bcrypt"] }
1818
pbkdf2 = { version = "0.13.0-rc.1", default-features = false, path = "../pbkdf2" }
19-
sha2 = { version = "0.11.0-rc.2", default-features = false }
19+
sha2 = { version = "0.11.0-rc.3", default-features = false }
20+
21+
# optional features
2022
zeroize = { version = "1", default-features = false, optional = true }
2123

2224
[dev-dependencies]

password-auth/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ edition = "2024"
1717
rust-version = "1.85"
1818

1919
[dependencies]
20-
password-hash = { version = "0.6.0-rc.0", features = ["alloc", "rand_core"] }
21-
rand_core = { version = "0.9", features = ["os_rng"] }
20+
getrandom = { version = "0.3", default-features = false }
21+
password-hash = { version = "0.6.0-rc.2", features = ["alloc", "getrandom"] }
2222

2323
# optional dependencies
2424
argon2 = { version = "0.6.0-rc.0", optional = true, default-features = false, features = ["alloc", "simple"], path = "../argon2" }
2525
pbkdf2 = { version = "0.13.0-rc.0", optional = true, default-features = false, features = ["simple"], path = "../pbkdf2" }
2626
scrypt = { version = "0.12.0-rc.0", optional = true, default-features = false, features = ["simple"], path = "../scrypt" }
27-
getrandom = { version = "0.3", optional = true, default-features = false }
2827

2928
[features]
3029
default = ["argon2", "std"]

0 commit comments

Comments
 (0)