coreutils
coreutils copied to clipboard
cksum: implement `-a`
Used by tests/misc/sm3sum.pl
-a, --algorithm=TYPE
select the digest type to use. See DIGEST below.
[...]
DIGEST determines the digest algorithm and default output format:
sysv
(equivalent to sum -s)
bsd
(equivalent to sum -r)
crc
(equivalent to cksum)
md5
(equivalent to md5sum)
sha1
(equivalent to sha1sum)
sha224
(equivalent to sha224sum)
sha256
(equivalent to sha256sum)
sha384
(equivalent to sha384sum)
sha512
(equivalent to sha512sum)
blake2b
(equivalent to b2sum)
sm3
(only available through cksum)
When checking, the input should be a former output of this program, or equivalent standalone program.
See https://github.com/uutils/coreutils/issues/3811
also tested by
tests/misc/cksum-a.sh
I'm looking into working on this-- Is it ok if I pull in an external library for some hashes, and should I move the sysv and bsd sums from sum into uucore so they can be shared?
Yeah I think that's fine. Be sure to check out the hashsum util as well. There's probably some code there that you can reuse too. Also, you can start with an implementation that only supports a few algorithms.
Hi @tertsdiepraam as you know I am working on this issue. I have a question about reusing the code in hashsum. I think I may reuse some code in hashsum/digest.rs
. Should I move them to a place for common functions? Or I just make a copy of those codes to cksum
?
For common functions, we move them in src/uucore/src/lib/features :)