-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
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
BenWiederhake