]> git.ipfire.org Git - thirdparty/coreutils.git/commit
cksum: add support for SHA-3
authorCollin Funk <collin.funk1@gmail.com>
Sun, 31 Aug 2025 23:56:08 +0000 (16:56 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Thu, 4 Sep 2025 05:29:33 +0000 (22:29 -0700)
commit403d82a0bf9e350642933ec44cd4e0ef1fdc0c28
treec15d3b2332a56dc3fcb20ab42452c346c98d1c00
parent022673367b7e3652410bce912a12a43c2e5f4607
cksum: add support for SHA-3

* src/digest.c: Include sha3.h.
(BLAKE2B_MAX_LEN): Rename to
DIGEST_MAX_LEN since it is also used for SHA-3.
(sha3_sum_stream): New function.
(enum Algorithm, algorithm_args, algorithm_args, algorithm_types)
algorithm_tags, algorithm_bits, cksumfns, cksum_output_fns): Add entries
for SHA-3.
(usage): Mention that SHA-3 is supported. Mention requirements for
--length with SHA-3.
(split_3): Use DIGEST_MAX_LEN instead of BLAKE2B_MAX_LEN. Determine the
length of the digest for SHA-3. Make sure it is 224, 256, 384, or 512.
(digest_file): Set the digest length in bytes. Use DIGEST_MAX_LEN
instead of BLAKE2B_MAX_LEN. Always append the digest length to SHA3 in
the output.
(main): Allow the use of --length with 'cksum -a sha3'.  Use
DIGEST_MAX_LEN instead of BLAKE2B_MAX_LEN. Make sure it is 224, 256,
384, or 512.
* tests/cksum/cksum-base64.pl (@pairs): Add expected sha3 output.
(fmt): Modify the output to use SHA3-512 since that is the default.
(@Tests): Modify arguments for sha3 to use --length=512.
* tests/cksum/cksum-sha3.sh: New test, based on tests/cksum/b2sum.sh.
* tests/local.mk (all_tests): Add the test.
* bootstrap.conf: Add crypto/sha3.
* gnulib: Update to latest commit.
* NEWS: Mention the change.
* doc/coreutils.texi (cksum general options): Mention sha3 as a
supported argument to the -a option. Mention that 'cksum -a sha3'
supports the --length option. Mention that SHA-3 is considered secure.
NEWS
bootstrap.conf
doc/coreutils.texi
gnulib
src/digest.c
tests/cksum/cksum-base64.pl
tests/cksum/cksum-sha3.sh [new file with mode: 0755]
tests/local.mk