]> git.ipfire.org Git - thirdparty/coreutils.git/commit
cksum: support digest detection for tagged format
authorPádraig Brady <P@draigBrady.com>
Sat, 11 Sep 2021 15:19:39 +0000 (16:19 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 15 Sep 2021 19:44:18 +0000 (20:44 +0100)
commit772173a8328ffdbde7a6639f456b36a5522e60bc
tree194d0bd90cefaee0bda340a12ccb1a3b2589ae7c
parent217cd278ec36319e6d6fead52b740e96648633bb
cksum: support digest detection for tagged format

Support `cksum --check FILE` without having to specify a digest
algorithm, allowing for more generic file check instructions.
This also supports mixed digest checksum files, supporting
more robust multi digest checks.

* src/digest.c (algorithm_from_tag): A new function to
identify the digest algorithm from a tagged format line.
(split3): Set the algorithm depending on tag, and update
the expected digest length accordingly.
* tests/misc/cksum-c.sh: Add a new test.
* tests/local.mk: Reference the new test.
* tests/misc/md5sum.pl: Adjust to more generic error.
* tests/misc/sha1sum.pl: Likewise.
* doc/coreutils.texi (md5sum invocation): Mention the new -c feature.
* NEWS: Mention the new feature.
NEWS
doc/coreutils.texi
src/digest.c
tests/local.mk
tests/misc/cksum-c.sh [new file with mode: 0755]
tests/misc/md5sum.pl
tests/misc/sha1sum.pl