How to create a SHA256SUMS file?

4

I can check the content of several files in a directory against checksums contained in a file named for example SHA256SUMS with sha256sum -c SHA256SUMS.

  1. Is there an easy way to generate a SHA256SUMS file for all files in a directory?

  2. What is the exact syntax of the SHA256SUMS file and where is the documentation (if any) of that syntax?

Gustave

Posted 2015-07-14T12:34:34.230

Reputation: 997

1What is your operating system? – DavidPostill – 2015-07-14T12:37:31.390

Using Bash on Ubuntu. But I hope to get an answer that works on most linuxes. – Gustave – 2015-07-14T12:40:59.977

Solved it now with: sha256sum -b * > SHA256SUMS. Part 2 of question is still open. – Gustave – 2015-07-14T12:41:21.087

See my answer for your part 2. – DavidPostill – 2015-07-14T12:46:30.970

Answers

2

Probably not the best solution, but it worked for me:

cd directory
sha256sum -b * > SHA256SUMS

Don't know what it does if there are sub-directories in directory. For documentation see DavidPostill's answer.

Gustave

Posted 2015-07-14T12:34:34.230

Reputation: 997

0

sha256sum -b does not work recursively

Do this: find . -type f -exec sha256sum {} > checksums.txt \;

-type -f is needed to exclude directories , -exec rather than -execdir in order to get the path included in the checksums list, which facilitates automatic checking

pastic

Posted 2015-07-14T12:34:34.230

Reputation: 3

0

Where is the documentation for sha256sums?

The GNU Core Utils documentation for md5sum can be found at:

In addition:

The full documentation for sha256sum is maintained as a Texinfo manual. If info and sha256sum are properly installed at your site, the command

info coreutils 'sha256sum invocation'

should give you access to the complete manual.

Source sha256sum — compute and check SHA256 message digest

DavidPostill

Posted 2015-07-14T12:34:34.230

Reputation: 118 938

I would have to learn how to use "info" first. But I found an easier to read online version, which points to the md5sum documentation at http://www.gnu.org/software/coreutils/manual/coreutils.html#md5sum-invocation.

– Gustave – 2015-07-14T14:56:40.390