If I have downloaded a file from the internet, and the source website has provided a checksum or hash (eg. SHA-256), how do I verify that the hash of the downloaded file matches the hash reported on the site?
For example, I’ve downloaded a file, and the website states that the SHA-256 hash for it is:
d9cd63f187db2daea1371289508c63a7a24c46316f15ac61f030a7d6ea423915
I do know how to create an SHA-256 hash of the downloaded file using:
shasum -a 256 /path/to/downloaded.pkg
However, I don’t want to do a manual, a.k.a. eyeball, check of the hash. Instead I want to compare the two hashes using a command like diff
, preferably by executing a single command-line.