Assuming bash scripting is available
Copy the bash-script below as 'cksum.sh' into a folder that is included in your $PATH
Type chmod 755 cksum.sh
(within the folder you saved the script in)
Then to use it; cd
into the folder with the original files, and do:
$ cksum.sh -b
to create a 'CONTENT.sha256sum' file.
$ cksum.sh -c
to check the checksums in the file against files in the current dir.
You may also provide a filename for the checksums as a second argument, to override the default, which is always created in/read from the current working dir (note: excluded from the checksum file).
This is most certainly slower than many other solutions, but I believe it is more versatile than others.
Note also that if you leave the checksum file on the media (be it CD, DVD or USB) then checking the media content is a simple
sha256sum -c CONTENT.sha256sum
at any time, assuming you have the sha256sum executable.
It detects faulty and missing files, but not 'added files' (as written); but that is possible by matching the folder content to the list content.
The end user may also detect faulty (e.g. read errors) and replaced files by finding the sha256sum executable and using sha256sum -c CONTENT.sha256sum
.
--- cksum.sh ---
#!/bin/bash
file="$2"
file="${file:=CONTENT.sha256sum}"
case "$1" in
"-b" )
( find -type f ! -iname "*$file" 2>/dev/null \
| while read f ;do sha256sum -b "$f" ;done ) \
| tee "$file"
;;
"-c" )
if [ ! -r "$file" ] ;then
echo "'$file' is not a readable file, cannot check."
else
sha256sum -c "$file"
fi
;;
* )
echo "Usage: ${0##*/} -b|-c [checksum-filename]"
echo "Will create(-b)/check checksums in '$file'"
echo "for files in current dir,"
echo "by use of 'find -type f' and 'sha256sum -b/-c'"
;;
esac