≡ Menu

md5_hash

You need to verify that that downloaded Linux DVD or ISO images are intact before you burn and use them. This is security feature. But how do you verify ISO images?

Answer is quite simple use md5sum command to compute and check MD5 message digest.

Why verify ISO images?

a) To protect yourself
b) Verify that a file has not changed as a result of file transfer, disk error, cracker attacks, etc.

How does it work?

When you run md5sum command on ISO file, you get checksum (or hash) on screen. You need to compare this checksum with original. It works as a compact digital fingerprint of a file. You can then compare the MD5 hash of your download ISO file, to the known good hash of the file you are checking. If the two values match, you are safe and use the ISO image.

Example

Let us download FreeBSD ISO image:
$ cd /tmp
$ wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/6.2/6.2-RELEASE-i386-bootonly.iso

Next download MD5 checksum:
$ wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/6.2/CHECKSUM.MD5

Generate MD5 hash for ISO image

$ md5sum 6.2-RELEASE-i386-bootonly.iso
Output:

4e8701ac951bc4537f8420fdac7efbb5  6.2-RELEASE-i386-bootonly.iso

Verify ISO image

See the known good hash of the file (6.2-RELEASE-i386-bootonly.iso):
$ md5sum -c CHECKSUM.MD5
Output:

6.2-RELEASE-i386-bootonly.iso: OK

You can also use following command for the same purpose:

A note for Windows XP / Vista users

md5sum command is use to check or print MD5 (128-bit) checksums. For example purpose download your favorite Linux distribution from Linux distribution web site / project site. Now you will need to to check md5sum on a Linux ISO file.

1) Download Debian linux # 1 ISO please note down md5sum listed next to each ISO file with the help of wget command:
$ wget http://someproject.org/path/to/isofile.iso

2) Verify integrity of a Linux iso:
$ md5sum isofile.iso
Output:

a0b162e26281ef097ee8b39b8690a8c2 isofile.iso

Compare output (a0b162e26281ef097ee8b39b8690a8c2) with key listed online at linuxiso.org's site.

You can read MD5 sums from the FILEs and check them:
$ md5sum -c xcache-1.2.2.tar.gz.md5.txt
Sample output:

xcache-1.2.2.tar.gz: OK

Online References: