-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
cksum: Add SHA3/SHAKE support and --debug flag #8948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
naoNao89
wants to merge
4
commits into
uutils:main
Choose a base branch
from
naoNao89:fix-cksum-sha3-debug-8933
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Fixes uutils#8933 - Add --debug flag (no-op matching GNU behavior) - Enable SHA3 with --length (224, 256, 384, 512) - Enable SHAKE128/SHAKE256 with --length - Fix error messages to say '--length required' in cksum context - Update help text to document SHA3/SHAKE algorithms - Add French translations Changes: - Relaxed --length restriction to allow sha3/shake algorithms - Added error message remapping for correct context - Updated localization files (en-US, fr-FR)
GNU testsuite comparison:
|
Could you please add tests to make sure we don't regress in the future? Thanks |
evilpie
reviewed
Oct 18, 2025
sylvestre
reviewed
Oct 19, 2025
…ength refactor(uucore,cksum): add detect_algo_with_label to produce cksum-specific '--length required' errors for SHA3/SHAKE; update cksum to use it and remove string remapping. All tests pass (10 new).
GNU testsuite comparison:
|
sylvestre
reviewed
Oct 20, 2025
Replaces the last occurrence of ChecksumError::LengthOnlyForBlake2b with an accurate error message listing all algorithms that support --length (blake2b, sha3, shake128, shake256). This completes the refactoring started in the previous commit where detect_algo_with_label() was introduced.
Rename detect_algo_with_label parameter from 'use_length_label' to 'is_cksum' for better self-documentation: - When true: cksum (error messages use '--length') - When false: hashsum tools (error messages use '--bits') This makes the code's intent clear without comments.
GNU testsuite comparison:
|
08769f4
to
cbb156c
Compare
please move the --debug implementation in a different PR |
sr, i missed pushing the commit from 8949 to 8948 🤡 |
GNU testsuite comparison:
|
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.
Fixes #8933
This adds the missing
--debug
flag and enables SHA3/SHAKE algorithm support with--length
.The fix addresses an inconsistency where error messages said
--bits required
but cksum uses--length
. I traced this through git blame to the original checksum.rs implementation—the error text was written for hashsum's--bits
flag. Rather than break hashsum, I remap the error message in cksum's context.SHA3 and SHAKE now work as intended. The algorithms were already implemented; they just needed the length restriction lifted.