Repository navigation
chore(deps): upgrade argon2 to 0.6 and scrypt to 0.12 - #176
Merged
Merged
Conversation
Both move to password-hash 0.6 (digest 0.11, rand_core 0.10 / getrandom 0.4). - argon2/scrypt: salts are now drawn by the crates' `hash_password` (password-hash's `try_generate_salt`, getrandom), so an RNG failure maps to CasError::PasswordHashingFailed instead of panicking. - scrypt 0.12 has no default features: enable `phc` and `getrandom`. Pin the default cost (ln=17, r=8, p=1) and the 32-byte output explicitly. - argon2 defaults (Argon2id v19, m=19456, t=2, p=1, 32-byte output) are unchanged in 0.6. - pbkdf2::derivation generates 16 bytes with getrandom and returns their 22-character PHC "B64" salt string, the same shape as before. - argon2 KDF salt generation stays on rand 0.8 (rand is #172). Adds regression tests that verify argon2 and scrypt PHC strings made by cas-lib 0.7.1 (argon2 0.5.3 / scrypt 0.11.0), and tests that pin the default parameters and the pbkdf2 salt shape. Part of #168 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the adjacent-line Cargo.toml conflict: keep #175's getrandom comment (now also naming PBKDF2 salts) and this branch's scrypt 0.12 line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 27, 2026
Closed
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves the password hashers to password-hash 0.6 (digest 0.11, rand_core 0.10 / getrandom 0.4).
phc0.6.1)The lockfile also drops
blake20.10,cipher0.4,inout0.1 andpbkdf20.12, which only the old crates pulled in.SaltString::generate(&mut OsRng); the hashers now call the crates'hash_password(password), which draws a 16-byte salt through getrandom (try_generate_salt). An RNG failure becomesCasError::PasswordHashingFailedinstead of a panic.Cargo.tomlenablesphcandgetrandom. The default cost (ln=17, r=8, p=1) and the 32-byte output are now pinned explicitly.m=19456, t=2, p=1, 32-byte output). The KDF constants were already pinned.SaltString. It fills 16 bytes withgetrandom::filland returns their 22-character PHC "B64" salt string, the same length and format as before.generate_salt) stays on rand 0.8 (rand::rngs::OsRng); rand is Upgrade rand 0.8 to 0.10 (or replace it with getrandom 0.4) once the RustCrypto stack is migrated #172.docs/EXAMPLES.mdis unchanged.Compatibility evidence
CASArgon::hash_password,CASArgon::hash_password_parameters(19, 2, 1, …),CASScrypt::hash_passwordandCASScrypt::hash_password_customized(…, 10, 8, 1). They are stored as literals intests/password_hashers.rs.argon2_verifies_hashes_from_earlier_releases/scrypt_verifies_hashes_from_earlier_releases: with the new crates, the correct password verifies and a wrong password doesn't, for all four.default_parameters_are_unchanged: new hashes still carry$argon2id$v=19$m=19456,t=2,p=1$/$scrypt$ln=17,r=8,p=1$, with a 22-char salt and a 43-char (32-byte) hash.pbkdf2_derivation_salt_shape_is_unchanged: the salt is 22 B64 characters, matching what the base branch produced (e.g.wg24+3b29iyEXpdoMwBrWw).argon2_verify_still_accepts_hashes_below_the_hashing_minimumsbuilds its weak hash with the argon2 crate directly, so only its salt-generation call was updated to the 0.6 API.Test results (Windows, local)
cargo build --release --locked: OK, no warningscargo test --release --locked: 232 passed, 0 failed (password_hashers: 39, including the 3 new tests; Wycheproof: 21; aes_kw: 14; pqc: 21)cargo audit --deny unsound --deny yanked: cleanStacking
This PR is stacked on #173 (digest 0.11) and based on
deps/167-digest-0.11. Until #173 merges intodeps/rustcrypto-upgrades, the diff here also shows #173's commit (20bf931).Part of #168
🤖 Generated with Claude Code