Repository navigation
MemberCheck verifies BLAKE2sp, plain or keyed, alongside CRC32 (RustyGet) - #368
Merged
Merged
Conversation
…Get) A BLAKE2sp-only RAR 5.0 member (-htb) used to have no check (NoCrc32). MemberCheck now carries the recorded CRC32, BLAKE2sp, or both. verify(crc, blake) passes only when every recorded value is given and matches; matches_blake2sp compares the digest alone. A keyed (-p, hash-key flag) BLAKE2sp is tweaked with the derived hash key, like the CRC32. crypto::rar5_tweak_blake2sp is now public beside rar5_tweak_crc32. API change: recorded_crc32() returns Option<u32>. matches(crc) is false for a member that records no CRC32. NoCrc32 now means no checksum at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYJFfVCupfunL2idYi
Collaborator
Author
|
@codex review |
A caller that treated NoCrc32 as "unverifiable" would have compiled unchanged and then rejected good output, since a BLAKE2sp-only member now gets a check whose matches(crc) is false. The rename makes such code fail to compile so it is revisited. New test: a two-volume keyed BLAKE2sp member takes its whole-output digest and hash-key flag from the final part, never part 1's packed hash, and is Incomplete without the final volume. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYJFfVCupfunL2idYi
Collaborator
Author
|
Local CI @ 7055dd2 (up to date with origin/main): ALL GATES PASSED on all three platforms: x86_64 (spot rustyget-x86-q), arm64 (spot rustyget-arm-g) and macOS (m4air). Each ran fmt, clippy x2, tests x2 and doctests x2. |
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.
Backs RustyGet#817 (direct RAR 5.0 BLAKE2sp member verification).
What changes
MemberMap::member_checkno longer returnsNoCrc32for a BLAKE2sp-only RAR 5.0 member (-htb). The check carries the recorded CRC32, BLAKE2sp, or both.MemberCheck::verify(plain_crc32: Option<u32>, plain_blake2sp: Option<&[u8; 32]>)passes only when every checksum the member records was given and matches, so both when both are recorded. A value given for an unrecorded checksum is ignored.MemberCheck::matches_blake2sp(&[u8; 32])compares the BLAKE2sp alone.-pwith the hash-key flag) has its BLAKE2sp tweaked with the derived hash key before comparing, exactly like the CRC32. The caller always passes plain digests (zipfast::blake2sp::Blake2sp).zipfast::crypto::rar5_tweak_blake2spis nowpub, besiderar5_tweak_crc32.recorded_blake2sp() -> Option<[u8; 32]>is new.API changes
recorded_crc32()returnsOption<u32>(it wasu32).matches(crc)is false for a member that records no CRC32.NoCrc32now means no checksum at all: a directory, or a 7z member of a multi-member folder without its own digest.Debugshows whether a BLAKE2sp is recorded, and still never shows the hash key.Tests
tests/member_check.rs, 5 new tests, 10 in total:rar5_encrypted,member_mapand the doctests also pass. fmt and both clippy runs are clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01LG44gYJFfVCupfunL2idYi