From ead07bb3d461389bb52336109be7858458e49c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Fri, 3 Feb 2023 16:34:18 +0000 Subject: cksum: add --raw option to output a binary digest --raw output is the most composable format, and also is a robust way to discard the file name without parsing (escaped) output. Examples: $ cksum --raw -a crc "$afile" | basenc --base16 4ACFC4F0 $ cksum --raw -a crc "$afile" | basenc --base2msbf 01001010110011111100010011110000 $ cksum --raw -a sha256 "$bfile" | basenc --base32 AAAAAAAADHLGRHAILLQWLAY6SNH7OY5OI2RKNQLSWPY3MCUM4JXQ==== * doc/coreutils.texi (cksum invocation): Describe the new feature. * src/digest.c (output_file): Inspect the new RAW_DIGEST global, and output the bytes directly if set. * src/cksum.c (output_crc): Likewise. * src/sum.c (output_bsd, output_sysv): Likewise. * tests/misc/cksum-raw.sh: A new test. * tests/local.mk: Reference the new test. * NEWS: Mention the new feature. --- doc/coreutils.texi | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'doc') diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 4d7d9439d..412c513a0 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -4059,6 +4059,17 @@ input digest string as what is output. I.e., removing or adding any @opindex --debug Output extra information to stderr, like the checksum implementation being used. +@item --raw +@opindex --raw +@cindex raw binary checksum +Print only the unencoded raw binary digest for a single input. +Do not output the file name or anything else. +Use network byte order (big endian) where applicable: +for @samp{bsd}, @samp{crc}, and @samp{sysv}. +This option works only with a single input. +Unlike other output formats, @command{cksum} provides no way to +@option{--check} a @option{--raw} checksum. + @item --untagged @opindex --untagged Output using the original Coreutils format used by the other -- cgit v1.2.1