Feedback Form
Home Open Source Tips and Tutorials How to check MD5 hash and create checksum file in Windows and Linux?
Thursday, 19 February 2009 10:20

 

MD5 is a widely used cryptographic hash function with a 128-bit hash value. It is commonly used to check the integrity of files.

If you downloaded a file from the web and the file owner provided a MD5 hash

(checksum) then you can compare the hash of the downloaded file with the hash

provided by file owner. So you will know if you have downloaded the exact copy of the

file without any error.

And of course you can provide MD5 hash for your own files if you want.

Windows

In Windows I use an open source software HashCheck to MD5 hash verifying and

creating.

Download HashCheck from here then install it.

1, Verify the MD5 hash

HashCheck is a shell extension for windows explorer, it will add a "Checksums" tab

to the shell's file properties dialog so that you could easily check the hash of a file from

Windows Explorer.

In the following exaple I checked the hash of Joomla 1.5.6 to 1.5.9 upgrade patch file

with HashCheck.

 

As you can see in the above screenshot my copy of Joomla upgrade patch is correct.

If the file owner provided the MD5 hash stored in a checksum file such as file.md5,

just double-click on the checksum file, and HashCheck will check it.

2, Create a checksum file

You can also create hash/checksum file of your files with HashCheck.

Select the files and directories that you want to hash and create a checksum file for,

right-click on them, and select "Create Checksum File". Double-click on the

created checksum file and you will see the hash(es).

HashCheck supports the CRC-32 (in SFV format), MD4, MD5, and SHA-1 algorithms.

Linux

1, Verify the MD5 hash

In Linux the verifying process is more easy.

Open a terminal and type:

# md5sum /your/directory/yourfile

Press enter and you will see the MD5 hash. Compare it with the MD5 hash provided by file owner.

In my case:

# md5sum /home/laja/Downloads/Progik/Joomla_1.5.6_to_1.5.9-Stable-Patch_

Package.zip

4e9e98fb058253f6f87d54fbcacf8466 /home/laja/Downloads/Progik/Joomla_1.5.6_to_1.5.9-Stable-

Patch_Package.zip

The MD5 hash: 4e9e98fb058253f6f87d54fbcacf8466

My copy of Joomla upgrade patch is correct, see it on my Ubuntu Hardy desktop:

If the file owner provided the MD5 hash stored in a file such as file.md5, you can
simply verifying the MD5sum by
# md5sum -c /your/directory/file.md5
If all is correct, it will produce the message
file:OK

Make sure that the file and the corresponding .md5 checksum file are downloaded in the same directory otherwise the test will fail.

2, Create hash/checksum file

If you want to provide hash value of your file, it is simple.

# md5sum yourfile

This command generates a 32-bit MD5 hash value of your file, press enter and you

will see the hash (it is an example only):

4e9e98fb058253f6f87d54fbcacf8466 yourfile

If you want to store the MD5 hash in a checksum file, do the following:

Open a terminal and go to the directory where your file is exists.

# cd /your/directory/

Then create the checksum file

# md5sum yourfile > yourfile.md5

and make a test verifying

# md5sum -c yourfile.md5
yourfile: OK

 

Tags: MD5 - hash - checksum - create - generate - verify - Windows - Linux - Hashcheck - MD5sum - open source - tip - tutorial - howto
Last Updated ( Friday, 20 February 2009 07:11 )
 

Visitor Map

Recent Readers