This is a brief guide on how to check the checksum of a file you download to install on your computer. I will be showing you how to do this on your Mac.
A checksum is a value that represents the number of bits in a transmission message.
We want to check the checksum to detect high-level errors within data transmissions. Prior to transmission, every piece of data or file can be assigned a checksum value after running a cryptographic hash function.
How to check the checksum on your Mac
On your Mac, go open up "Terminal" and go to the folder that has the file you want to check the checksum for. In my example, my file is in my Downloads folder.
Open your "Terminal" or command line software (e.g. iTerm, etc.).
cd Downloads
ls
shasum -a 256 openjdk-16.0.2_osx-x64_bin.tar.gz
Notice that it has the checksum:
e65f2437585f16a01fa8e10139d0d855e8a74396a1dfb0163294ed17edd704b8
This is your sha256 checksum output.
Alternatively, we can use the OpenSSL version to check.
openssl sha256 openjdk-16.0.2_osx-x64_bin.tar.gz
Typically, the next step now is to compare this detail to the sha256 checksum with where you downloaded the file from.
Example of how you can check the checksum of a download
Here is an example of how we can check the checksum of a download.
We will use the example of downloading JDK 16 to your Mac, as you can also follow this as well.
- Go to https://jdk.java.net/16.
- Download JDK16 for your Mac. for Mac.
- We can find out what the checksum SHA256 for the download file should be by clicking on the sha256 link that is noted there.
- Let's click on it to display the SHA-256 checksum. It will show you something like this:
Note that the sha256 checksum is:e65f2437585f16a01fa8e10139d0d855e8a74396a1dfb0163294ed17edd704b8
If we compare to the sha256 checksum from our Terminal earlier:
That's it, you're all set now.