Linux MD5 HowTo

In cryptography, MD5 (Message-Digest algorithm 5) is a widely used cryptographic hash function with a 128-bit hash value. It is used throughout various operating systems for a diverse range of purposes.

We will take a look at the usage of the MD5 hashing for file verification using a command line MD5 tool. But before we do so I want you to be aware that MD5 has been cryptographically compromised. This means that it is not such a good tool for actual security/protective usage. Cryptographic experts have lately been recommending SHA-2 as the preferred method.

Aside the controversy of the cryptographic safety, MD5 is an excellent file verification tool and we shall take a look at a small session of verifying some CD ISO images. So get out your favorite terminal and let's go to the shell.

# This is our ISO image.
$ ls *iso
debian-505-i386-netinst.iso

# This is our MD5 sum file
$ ls *md5
debian-505-i386-netinst.iso.md5

# This is the content of the md5 file
$ cat debian-505-i386-netinst.iso.md5
81c7298203a33f84ccb8a6e46f358879  debian-505-i386-netinst.iso

# Finally we execute the check itself
$ md5sum -c debian-505-i386-netinst.iso.md5
debian-505-i386-netinst.iso: OK

This is a good example of how you can check a file that you downloaded from the internet that has an MD5 hash provided. If you need to transfer a file from one of your computers to another then you will need to create the MD5 sum file yourself. This is a pretty easy job as well.

$ ls
important-file.cash

# We create the MD5 sum file
$ md5sum important-file.cash > important-file.cash.md5

Now you simply transfer the important-file.cash and important-file.cash.md5 to your other machine and execute the procedure from the beginning of the article.

Mac users can do the same thing in the terminal. Those who do not want to use the terminal  can use the software: MD5 Filecheck. Simply drop the file to the application icon and you will get an MD5 hash. You can then verify it from the MD5 file.

For Windows users, there are plenty of applications available that allow you to check MD5 hash. A nice small tool is MD5 Check.

Your thoughts

No comments

Add comment

* - required field

*




*