Skip to content

cksum: Detect algorithm/digest size mismatch #6614

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

Closed
RenjiSann opened this issue Aug 3, 2024 · 1 comment
Closed

cksum: Detect algorithm/digest size mismatch #6614

RenjiSann opened this issue Aug 3, 2024 · 1 comment

Comments

@RenjiSann
Copy link
Collaborator

While working on a workaround for #6572 , I realized that the way we guess the number of bits for BLAKE2b (when it differs from standard 512) is wrong.

Indeed, for this, it seems to look at the size given in the algorithm name, while we are looking guessing it from the size of the digest.

See the following example :

$ echo -n 'foo' > foo.dat

$ cksum --algo=blake2b --length=48 --base64 foo.dat | tee foo.sums    
BLAKE2b-48 (foo.dat) = Fxzf34Tt

For now, cksum still works

$ cksum --check foo.sums
foo.dat: OK

We remove '-48' from the algo name

$ sed -i 's/-48//' foo.sums && cat foo.sums
BLAKE2b (foo.dat) = Fxzf34Tt

Now both implementation fail but for different reasons

$ cksum --check foo.sums                   
cksum: foo.sums: no properly formatted checksum lines found

$ ../target/debug/cksum --check foo.sums
foo.dat: FAILED
../target/debug/cksum: WARNING: 1 computed checksum did NOT match
@cakebaker
Copy link
Contributor

Fixed by #6929

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants