Skip to content

blake3: check-mode interop fixes and parser polish#3782

Merged
jqnatividad merged 2 commits intomasterfrom
blake3-review-202604
Apr 29, 2026
Merged

blake3: check-mode interop fixes and parser polish#3782
jqnatividad merged 2 commits intomasterfrom
blake3-review-202604

Conversation

@jqnatividad
Copy link
Copy Markdown
Collaborator

Summary

  • check_mode: compare hashes with eq_ignore_ascii_case so checksum files containing uppercase hex verify correctly (matches blake3's Hash::from_hex case-tolerant parsing).
  • parse_standard_line: also accept the standard *sum binary-mode <hash> *<filename> separator alongside the text-mode two-space form for interop with files produced by other tooling.
  • parse_tag_line: make the caller-side BLAKE3 ( prefix invariant explicit via strip_prefix(...).expect(...) and use fail_clierror! consistently for the single failure path.
  • Tests: added uppercase-hex round-trip, binary-mode separator round-trip, and malformed-separator error coverage.

Test plan

🤖 Generated with Claude Code

jqnatividad and others added 2 commits April 29, 2026 07:34
- check_mode: compare hashes with eq_ignore_ascii_case so checksum
  files containing uppercase hex verify correctly (matches blake3's
  Hash::from_hex case-tolerant parsing).
- parse_standard_line: also accept binary-mode `<hash> *<filename>`
  separator alongside the text-mode two-space form for interop with
  standard *sum tooling.
- parse_tag_line: drop unreachable strip_prefix defensive branch
  (caller already gates on the `BLAKE3 (` prefix); use fail_clierror!
  consistently for the single failure path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… check-mode tests

- parse_tag_line: switch raw slicing back to strip_prefix(...).expect(...)
  so the caller-side prefix invariant is documented and a violation
  panics with a clear message instead of an opaque slice OOB.
- tests: cover the two new check_mode behaviors and a malformed-separator
  guard (uppercase hex round-trips OK, `<hash> *<filename>` binary-mode
  separator round-trips OK, single-space-without-asterisk errors).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves qsv blake3 --check interoperability with checksum files produced by other tools by making hash comparisons case-insensitive and expanding accepted checksum line formats, with accompanying regression tests.

Changes:

  • Make --check hash comparisons ASCII-case-insensitive so uppercase hex in checksum files verifies correctly.
  • Extend standard checksum parsing to accept both text-mode (<hash>␠␠<filename>) and binary-mode (<hash>␠*<filename>) separators.
  • Add tests covering uppercase-hex verification, binary-mode separator parsing, and malformed-separator error behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/cmd/blake3.rs Updates check-mode comparison logic and broadens checksum line parsing for better interop.
tests/test_blake3.rs Adds regression tests for uppercase hex, binary-mode separator acceptance, and malformed separator rejection.

@jqnatividad jqnatividad merged commit b3deffc into master Apr 29, 2026
17 of 21 checks passed
@jqnatividad jqnatividad deleted the blake3-review-202604 branch April 29, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants