Verifying File Hashes With Zsh or Bash
[Shell, Linux, OSX]
In a previous post, I discussed verifying file hashes using PowerShell. PowerShell
is cross-platform, which means it will work on any operating system that supports it, particularly the usual suspects—Windows, Linux, and macOS.
However, what are your options if you don’t have access to PowerShell
?
The default shells on Linux and macOS support this via the shasum command.
Let us again use our example, the utility HandBrake.
To verify the SHA-256
checksum, we would do it as follows:
shasum -a 256 HandBrake-1.9.2.dmg
The -a
allows you to specify the algorithm to use.
You should get the following output:
The available options are:
Parameter | Algorithm |
---|---|
1 | SHA-1 |
224 | SHA-224 |
256 | SHA-256 |
384 | SHA-384 |
512 | SHA-512 |
If you don’t specify an algorithm, SHA-1
, the default, will be used.
TLDR
The shasum
command allows for the generation of checksums using various algorithms on bash and zsh shells
Happy hacking!