shasum
Terminal
$ sha256sum -t
Enter the text and press ctrl+d
when you are finished.
Algorithm
$ shasum -a 256 file.txt
Check
sha256sum -c file.txt
In Action
$ echo "What>" > file1.txt
$ echo "Where" > file2.txt
$ echo "who" > file3.txt
$ ls
file1.txt file2.txt file3.txt
$ shasum -a 512 file*.txt > verify.sha512
$ ls
file1.txt file2.txt file3.txt verify.sha512
$ cat verify.sha512
c4ccea3c07cca09da47e7d298144ce6326adc8254a023d4ef3f8846c1a5d5ccda5c6dd61dd0c44bc085db2cae68e7fc7ead4641bab2ae39c5b6b13fd78611be7 file1.txt
a9a9e36fdaffe44e5869f41e31b829929861a726d4111f8e15f2ba474cc0887ee8e49120811fb83abee1b19b756ed76b8672ee164131c6136ada59b6004e2c6e file2.txt
46a6f793ac87ee9168e100077731b6f6c30f9c05f65cf7dfdcd4d8f93465e5e7f217dbafc21ae903a0e06e8e1e1432bef7cffcbbd8ad10ca253193f3727ad6f0 file3.txt
$ shasum -c verify.sha512
file1.txt: OK
file2.txt: OK
file3.txt: OK
$ echo "false" >> file2.txt
$ cat file2.txt
Where
false
$ shasum -c verify.sha512
file1.txt: OK
file2.txt: FAILED
file3.txt: OK
shasum: WARNING: 1 computed checksum did NOT match