Skip to content

cksum: Bring back blake3 algorithm#11316

Merged
RenjiSann merged 3 commits intouutils:mainfrom
RenjiSann:cksum-blake3
Mar 21, 2026
Merged

cksum: Bring back blake3 algorithm#11316
RenjiSann merged 3 commits intouutils:mainfrom
RenjiSann:cksum-blake3

Conversation

@RenjiSann
Copy link
Collaborator

Fix #10002

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/cut/bounded-memory is now being skipped but was previously passing.
Note: The gnu test tests/tail/pipe-f is now being skipped but was previously passing.

@oech3

This comment was marked as resolved.

@RenjiSann RenjiSann force-pushed the cksum-blake3 branch 4 times, most recently from b2d43e2 to 3387ee5 Compare March 13, 2026 16:16
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 13, 2026

Merging this PR will degrade performance by 99.88%

❌ 2 regressed benchmarks
✅ 298 untouched benchmarks
⏩ 46 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation cksum_blake3 116.3 µs 93,152.5 µs -99.88%
Memory cksum_blake3 33.9 KB 43.5 KB -21.95%

Comparing RenjiSann:cksum-blake3 (f9c8370) with main (d830e84)

Open in CodSpeed

Footnotes

  1. 46 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@oech3
Copy link
Contributor

oech3 commented Mar 13, 2026

CodSpeed is invalid since it is based on a bunch of clap error.

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)

@RenjiSann RenjiSann force-pushed the cksum-blake3 branch 2 times, most recently from 72790dd to 45b28c6 Compare March 16, 2026 13:35
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/date/resolution (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/tail/pipe-f is now being skipped but was previously passing.
Congrats! The gnu test tests/printf/printf-surprise is now passing!
Note: The gnu test tests/seq/seq-epipe was skipped on 'main' but is now failing.

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/rm/isatty. tests/rm/isatty is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/expand/bounded-memory is now passing!

1 similar comment
@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/rm/isatty. tests/rm/isatty is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/expand/bounded-memory is now passing!

@RenjiSann RenjiSann marked this pull request as ready for review March 17, 2026 15:49
Copy link
Contributor

@AldanTanneo AldanTanneo left a comment

Choose a reason for hiding this comment

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

If the length of blake3 is stored in bytes, it should validate that the input bit size is a multiple of 8, like in the blake2b implementation.

@oech3
Copy link
Contributor

oech3 commented Mar 20, 2026

Any length support is coming from https://github.com/BLAKE3-team/BLAKE3

@AldanTanneo
Copy link
Contributor

Any length support is coming from https://github.com/BLAKE3-team/BLAKE3

Your point?

@oech3
Copy link
Contributor

oech3 commented Mar 20, 2026

The existing b3sum support -l 7. So we should not validate to 8N bytes.

@AldanTanneo
Copy link
Contributor

The existing b3sum support -l 7. So we should not validate to 8N bytes.

Yes but the existing b3sum takes its input in bytes, not in bits, which goes against coreutils convention. The coreutils version should take the input in bits, and then validate that it's a multiple of 8 (like blake2b).

@oech3
Copy link
Contributor

oech3 commented Mar 20, 2026

We should not divergent interfaces. So we should be same with the b3sum.

@AldanTanneo
Copy link
Contributor

We should not divergent interfaces. So we should be same with the b3sum.

So matching the interface of a non GNU utility is more important that following the standard conventions for coreutils (always taking the length in bits)?

@oech3
Copy link
Contributor

oech3 commented Mar 20, 2026

Yes, Some people might have shebang compat wrapper (even it is very bad idea).

@oech3
Copy link
Contributor

oech3 commented Mar 20, 2026

To be honestly, I think we should just remove b3sum extenstons. We should not be interested in such wars.

@RenjiSann
Copy link
Collaborator Author

To be honestly, I think we should just remove b3sum extenstons. We should not be interested in such wars.

Ok so to explain my reasoning here:

  • IIUC, GNU is willing to support blake3 at some point, so it makes sense that we support it, either now or once GNU does. @pixelb you may want to add your 2 cents here.
  • The GNU convention is to interpret lengths as bits, not bytes, so if we want to be consistent with our own interface, bits is the way to go, even if it's incompatible with the existing b3sum.
  • If we ever want to relax the "multiple of 8" rule to support half-bytes digests like we do for SHAKE*, we will have backwards compatibility for free, whereas if we switch from bytes to bits, we will definitely break stuff WE were responsible of.

For all these reasons, I think we should interpret the length in bits for blake3 rather than in bytes.

@oech3
Copy link
Contributor

oech3 commented Mar 20, 2026

If we ever want to relax the "multiple of 8" rule to support half-bytes digests like we do for SHAKE*, we will have backwards compatibility for free, whereas if we switch from bytes to bits, we will definitely break stuff WE were responsible of.

I missed the case...

@RenjiSann
Copy link
Collaborator Author

I missed the case...

Sorry I don't understand what you mean. What do you mean ?

@oech3
Copy link
Contributor

oech3 commented Mar 20, 2026

sorry. Please forget the comment which is not important.

(ak::Sha1, _) => Ok(Self::Sha1),
(ak::Blake3, _) => Ok(Self::Blake3),

(ak::Blake3, l) => Ok(Self::Blake3(l)),
Copy link
Contributor

Choose a reason for hiding this comment

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

the length is not validated here, but it is for the blake2b algo

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've addressed that in #11437

@RenjiSann
Copy link
Collaborator Author

Benchmark test fails because I re-enabled one.
GNUTests seems to fail everywhere, so I assume that's not the changes in this PR

@RenjiSann RenjiSann merged commit f0805ff into uutils:main Mar 21, 2026
161 of 163 checks passed
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.

cksum: unknown algorithm: blake3: clap should have prevented this case

4 participants