How to Calculate MD5 Fingerprint on Linux for File Integrity Verification

In this tutorial, we will learn how to use the md5sum command to calculate the footprint of a file or, rather, of a message to use the term adapted to this context. For information, a fingerprint is used to calculate and verify the integrity of a file or data. If we take the same file in two versions but with only one bit of difference, its footprint will be totally different!

If a file no longer has the same footprint after being transferred from machine A to machine B, this calls into question its integrity. What happened? The file may have been corrupted intentionally or accidentallyFor example, the file may have become corrupted due to LAN-related packet loss. Conversely, if the fingerprint is still the same, it means that the file is strictly identical to the original file: its integrity has been preserved.

For example, when downloading a file from the Internet, it is common to see the file’s fingerprint, either MD5, SHA1, or SHA256. This reference value allows you to check the file’s integrity after downloading. Today, MD5 can still be used to verify the integrity of a file after it has been downloaded. However, for other security-related uses, MD5 is obsolete and should be abandoned in favor of more secure methods like SHA256.

II. Using the md5sum command

Natively integrated into Linux, the md5sum command will allow you to calculate the fingerprint of a file via the MD5 function.

For example, if we want to calculate the footprint of the “linux.txt” file, we will use the command like this:md5sum linux.txt

We will then have the fingerprint of this file as a result:

Linux - MD5 sum of a file

The returned value corresponds to the MD5 fingerprint of the file, which is also called ” checksum ” or ” checksum “.

See also  How to monitor your network traffic in real-time with Sniffnet

If you make the slightest modification in this file, for example, by adding a character, the checksum will no longer be the same:

Linux md5sum

We can also store this fingerprint in a file so that users can compare it again:md5sum linux.txt > Linux. checksum

You can also do a checksum of several files to be able to compare them easily:md5sum linux.txt linux2.txt

Linux - MD5 fingerprint of multiple files

Here, it is a copy and paste of the original file under another name: its content is not altered, so the fingerprint remains the same! This is important: the fingerprint is based on the file’s contents, not its name.

5/5 - (3 votes)

Mohamed SAKHRI

I am Mohamed SAKHRI, the creator and editor-in-chief of Tech To Geek, where I've demonstrated my passion for technology through extensive blogging. My expertise spans various operating systems, including Windows, Linux, macOS, and Android, with a focus on providing practical and valuable guides. Additionally, I delve into WordPress-related subjects. You can find more about me on my Linkedin!, Twitter!, Reddit

Leave a Comment