Skip to content

Publish shasum cli compatible hash files #1122

Description

@ronanchilvers

Currently the hash files published with each binary release are in a format that isn't consumable by the shasum perl script (that is commonly distributed with many Linux distributions and platforms) when using its --check option. When automating the download and hash check of a new version, there is some unpleasant parsing and rewriting of the current *_hashes.txt files to create a format which can be read correctly by shasum --check.

It would be really useful if binary releases could include an additional hash file in a shasum compatible format. From the shasum man page:

When verifying SHA-512/224 or SHA-512/256 checksums, indicate the
algorithm explicitly using the -a option, e.g.

shasum -a 512224 -c checksumfile

The sums are computed as described in FIPS PUB 180-4. When checking,
the input should be a former output of this program. The default
mode is to print a line with checksum, a character indicating type
(*' for binary, ' for text, U' for UNIVERSAL, ^' for BITS),
and name for each FILE. The line starts with a \' character if the FILE name contains either newlines or backslashes, which are then replaced by the two-character sequences \n' and `\' respectively.

The file can be generated by shasum itself to ensure the format is correct. A simple example (note this uses the default sha1 but other algorithms are supported):

$ touch testfile.txt
$ shasum testfile.txt
da39a3ee5e6b4b0d3255bfef95601890afd80709  testfile.txt
$ shasum testfile.txt > shasums.txt
$ shasum --check shasums.txt
testfile.txt: OK
$ cat shasums.txt
da39a3ee5e6b4b0d3255bfef95601890afd80709  testfile.txt

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions