Skip to content

Commit a108eff

Browse files
authored
Bump password-hash to v0.6.0-rc.2 (#737)
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 a108eff

File tree

18 files changed

+89
-106
lines changed

18 files changed

+89
-106
lines changed

.github/workflows/pbkdf2.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@ jobs:
3535
toolchain: ${{ matrix.rust }}
3636
targets: ${{ matrix.target }}
3737
- run: cargo build --target ${{ matrix.target }} --no-default-features
38-
- run: cargo build --target ${{ matrix.target }} --no-default-features --features simple
3938

4039
minimal-versions:
4140
if: false # disabled while using pre-releases
4241
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
4342
with:
44-
working-directory: ${{ github.workflow }}
43+
working-directory: ${{ github.workflow }}
4544

4645
test:
4746
runs-on: ubuntu-latest

.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: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,17 @@
2828
//!
2929
//! The following example demonstrates the high-level password hashing API:
3030
//!
31-
//! ```
31+
#![cfg_attr(feature = "getrandom", doc = "```")]
32+
#![cfg_attr(not(feature = "getrandom"), doc = "```ignore")]
3233
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
33-
//! # #[cfg(all(feature = "password-hash", feature = "std"))]
34-
//! # {
3534
//! use balloon_hash::{
36-
//! password_hash::{
37-
//! rand_core::OsRng,
38-
//! PasswordHash, PasswordHasher, PasswordVerifier, SaltString
39-
//! },
35+
//! password_hash::{PasswordHash, PasswordHasher, PasswordVerifier, SaltString},
4036
//! Balloon
4137
//! };
4238
//! use sha2::Sha256;
4339
//!
4440
//! let password = b"hunter42"; // Bad password; don't actually use!
45-
//! let salt = SaltString::try_from_rng(&mut OsRng)?;
41+
//! let salt = SaltString::generate(); // Note: needs the `getrandom` feature of `balloon-hash` enabled
4642
//!
4743
//! // Balloon with default params
4844
//! let balloon = Balloon::<Sha256>::default();
@@ -53,7 +49,6 @@
5349
//! // Verify password against PHC string
5450
//! let parsed_hash = PasswordHash::new(&password_hash)?;
5551
//! assert!(balloon.verify_password(password, &parsed_hash).is_ok());
56-
//! # }
5752
//! # Ok(())
5853
//! # }
5954
//! ```

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]

0 commit comments

Comments
 (0)