Tuesday, February 8, 2011

MD5 Hash and how to use it to check the integrity of files?


MD5 i.e. Message Digest Algorithm 5, is a cryptographic algorithm mainly used to check the file integrity and data encryption that might be the user-names and passwords of users stored in the database in MD5 hash form rather than the normal readable text.

Usually while we use hashing algorithms, it should be remebered that we can convert a text into hash forms but we cannot convert a hash to the original text in any way. That means to retrieve the texts we might need some tools that compare the hashes and display the result that matches with the concerned hash.
We however can check the integrity of files too through MD5 hashes. Suppose i downloaded the VLC player for my PC. Assume that the file i downloaded was found corrupted, that might be due to the data loss while downloading, due to instability of the internet connection, virus infections or due to hacker attacks, turning the file to be malicious.
That's why it is a nice practice to generate the MD5 hash before downloading the file on the server and after downloading the file on the PC. Compare the two, if they match, it means the file hasn't been tampered.
A MD5 hash is nothing but a 32 digit hexadicimal number which can be something as follows:
Sample MD5 Hash:
a9dd09c290dbfb1ca068efaddf22cbw0
This hash is unique for every file irrespective of it’s size and type. That means two .exe files with the same size will not have the same MD5 hash even though they are of same type and size. So MD5 hash can be used to uniquely identify a file.
MD5 hash for the downloaded file on your Windows PC can be generated using the following freeware tool:
MD5 Summer
Similar to MD5 algorithm there are various other cryptographic algorithms being

No comments: