HowTo: Verify Files Checksum in Linux
Written by: L. Caine
- Learn how to generate and verify files with MD5 Checksums in Linux – Rogue Exile Digital
Overview: This guide tells you about checksums, what md5 is, why it is used and how to use it to verify file/data integrity.
What is Checksum?
Well, technically this is a ‘digital fingerprint’ of a file/folder, if you will.
Let me break this down to a science for you:
A checksum is a datum used for the purpose of detecting malfunctions or errors that may have occurred in the process of the files transmission or during storage.
You can find checksums while downloading files from the internet/web, e.g. ISO images, Linux software packages and so on.
The most utilized method of checksums is to definitely make sure you haven’t just waited 20 minutes, only to download a corrupted file!
What is MD5?
A MD5 checksum is a 32 character hexadecimal number that is computed on a file.
- MD5 consists of a digest size of 128 bits and a block size of 512 bits, with a series of: *MD2, MD4, MD5, MD6*.
There is an awesome tool (* for Linux, Windows and Mac OS X*), available for usage to facilitate the verification of data integrity of a file you’ve downloaded to your machine, and it’s been finely named ‘md5sum‘ !
Most Linux distros ship with the utility in the repositories already, so that is a possibility of not having to install it to your system BUT, it doesn’t hurt to check, right?
Open up a terminal and run the following command:
You should get an output something like:
md5sum (GNU coreutils) 8.28 Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Ulrich Drepper, Scott Miller, and David Madore.
All Linux distros should have the program already, but if you do not have the program, you will need to visit https://packages.ubuntu.com/coreutils and download the package file, and then install it with
sudo dpkg -i <filename> where
<filename> is the name of the package file. (MAKE SURE TO DOWNLOAD ALL THE REQUIRED DEPENDENCIES FIRST)
Alternative GUI: ‘Checksum Calculator’:
This is a free file checksum utility, that can support the most commonly used checksum algorithms, e.g. md5, crc32, sha1, sha2, and it also can also batch process multiple files.
The Checksum Calculator can be downloaded from here if you aren’t too fond of using a terminal.
How to Verify a File with MD5SUM:
Check/Verify the file:
Open a terminal and
cdto the directory of the downloaded file.
Lucefer@ROGUE-EXILE-DIGITAL: ~$ cd Downloads
Within the directory run the command:
Your output should look something like:
Now just compare the MD5 output to the MD5 that was either downloaded with the file or from the web page you downloaded the file from.
If the hashes MATCH, then hey, not so shabby, your file is certainly still intact!
If the hashes DON’T match, then you might want to remove it from your system, and find a new download or a new website to download that file from, because chances are, that there was a problem with either the download, a problem with the server you obtained the file from or, plain and simple: ” Its been tampered with my friend!!!”. THROW IT OUT!
The Wrap Up:
So all you have to do now is be sure that you ALWAYS check the MD5/SHA hash that is in pair with whatever file you are downloading, cause its better to be SAFE, than SORRY cause your system got destroyed! cya exiles, CYA! (cover your assets)