The script is based on sha256sum
utility and allows to compare
SHA 256 sums without downloading a file with the sum.
-
Option 1: Download the sha256 script and add it to your
PATH
variable. -
Option 2: Add the following function to your
.bashrc
or.zshrc
file:sha256() { echo "$1 $2" | sha256sum --check }
Make sure you have sha256sum utility installed.
You can compare SHA 256 sums in the following way:
sha256 <expected-sha-256-sum> <name-of-the-file>
sha256 94f874037b82ea5353f4061e543681a0e79657f787437974214629af8407d124 go1.13.1.linux-amd64.tar.gz
The output if the sums match:
go1.13.1.linux-amd64.tar.gz: OK
The output if the sums do not match:
go1.13.1.linux-amd64.tar.gz: FAILED