A checksum is a calculated value using a cryptographic hash function to verify the integrity of data, such as a binary file. Checksums are mostly used for comparing between the source of a file and a copy of it to ensure that the copy is identical to the source.
For example, when downloading an ISO file especially an ISO image from the official site, generally, several checksums in different algorithms are also provided on the download page; e.g. MD5
and SHA-1
.
You can use your preferred algorithm to verify the integrity of your copy of the file if it's genuine. In other words, the calculated checksum must be exactly the same as the provided one.
Additionally, checksums are case insensitive, it doesn't matter if they are in lowercase or uppercase. A checksum is also known as a hash sum, hash value, hash code, or simply hash.
Verifying the checksum of a file on Linux is very simple and straightforward. Most Linux distributions already came with the command line tools for verifying checksums in various algorithms as listed below.
md5sum
sha1sum
sha224sum
sha256sum
sha384sum
sha512sum
For example, you can verify the SHA-1 checksum of the Debian 10.1 ISO with this command.
sha1sum debian-10.1.0-amd64-netinst.iso
It will result in the following checksum which is exactly the same as the SHA-1 checksum listed on the download page. Therefore, this downloaded ISO file is error free and not corrupted. You can use it in production with peace of mind.
c467e9bf37374e3fc63aa6aa22dbbe14d97ae3eb debian-10.1.0-amd64-netinst.iso
If the calculated checksum of a file doesn't match the provided one from a trusted source, this means the two files are not the same. Either the copy is corrupted or the source has been modified. A small change to the file even just a single byte will result in a completely different checksum as both files are no longer identical.
You should avoid using a defected copy of the source at all costs to prevent further damage it may cause. So just simply don't use it and redownload the file to check it again especially from a different server if it's an ISO image.