]> git.ipfire.org Git - thirdparty/coreutils.git/commit
cksum: add --raw option to output a binary digest
authorPádraig Brady <P@draigBrady.com>
Fri, 3 Feb 2023 16:34:18 +0000 (16:34 +0000)
committerPádraig Brady <P@draigBrady.com>
Mon, 6 Feb 2023 13:09:40 +0000 (13:09 +0000)
commitead07bb3d461389bb52336109be7858458e49c38
tree8d905a8a307dec94d422783162fc241dc659cc48
parent2984e47c789ebc39f55a3b1cb20b943de88eeedc
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.
NEWS
doc/coreutils.texi
src/cksum.c
src/cksum.h
src/digest.c
src/sum.c
src/sum.h
tests/local.mk
tests/misc/cksum-raw.sh [new file with mode: 0755]