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
This pull request adds support for the -l/--length option to b2sum (hashsum).
B2sum supports variable output size if
Related Issue
#4610
Remarks
This is my first attempt to contribute to this project, so I may have missed something. (same goes for naming conventions) !
I added a new function to allow creating a Blake2d instance with custom output size (
with_output_bytes
). I updated the reset function to use this new function instead of calling ::new().Eventually, the Blake2d tuple has now a new parameter to keep track of the custom size.
I had to create a new parsing step
uu_app_opt_length
that behaves more or less likeuu_app_opt_bits
but cannot share the same code due to different text / names.Tests
I added a simple test with the --length option enabled. I took example of the sha1 tests in the very same file.
related test:
bash util/run-gnu-test.sh tests/misc/b2sum-bsd.sh
(-l flags)Unfortunately, I only have Windows for now and I couldn't run the linux tests.