What is checksum and how to calculate and use checksum values to verify data and file integrity
Checksum is a calculated value that is used to determine the integrity of data. Checksum serves as a unique identifier for the data (a file, a text string, or a hexadecimal string). If the data changes then so does the checksum value. This makes it easy to verify the integrity of the data.
To test data integrity, the sender of the data calculates checksum value by taking the sum of the binary data transmitted. When receiving the data, the receiver can perform the same calculation on the data and compare it with the checksum value provided by the sender. If the two values match, the receiver has a high degree of confidence that the data was received correctly.
Checksum value is also called hash value. The data that is calculated can be a file, a text string, or a hexadecimal string.
The most commonly used checksum is MD5 (Message-Digest algorithm 5) hash. MD5 was designed by Professor Ronald L. Rivest in 1991 to replace an earlier hash function, MD4. MD5 checksum is a 128-bit hash value (32 characters).
Use checksum values
In practice, checksum values are mainly used in three situations.
First, checksum value can be used to check data integrity when data is sent through telecommunication networks such as Internet.
For example, serious software download sites often display MD5 checksum value for each file they offer for downloading. After download the file, you calculate the checksum value of the file you downloaded and compare with the checksum value provided by the download website. If they match, you are sure that the file is in good shape - not corrupted or modified. The checksum value becomes a fingerprint of the file.
Another example of using checksum is to calculate the hash value of a text string such as a password. MD5 hash value for the text 'test' (without quotes) is 098f6bcd4621d373cade4e832627b4f6. This is a 32-character GUID (Global Unique Identifier).
When storing a password in a database, it is always a good idea to store the password's hash such as MD5 checksum value. This way, the plain password is not exposed to anyone even though reversing MD5 to its original text string is possible for simple words by using dictionary attack.
Second, checksum value can be used to check data integrity of stored data to see if the data has been modified or changed in any way over time. Data can be modified in many ways. It may be infected by viruses, packet loss when transferring through networks, accidental or intentional human changes of data, or anything else.
For example, you may have a file that you created and stored on a network drive. How to make sure that the file is identical two months later when you want to use it again? You can calculate the file's checksum value when you first created it. When you need the file two months later, calculate its checksum again and compare with your previous checksum calculation. If they are the same, you can have high degree of confidence that the file has not been tampered with by anyone.
Third, checksum values can be used to verify data burned to CDROM, CD-R (Compact Disc-Recordable), OR DVD, DVD-R.
How to calculate checksum values
Copyright © 2017 GeeksEngine.com. All Rights Reserved.
This website is hosted by HostGator.
No portion may be reproduced without my written permission. Software and hardware names mentioned on this site are registered trademarks of their respective companies. Should any right be infringed, it is totally unintentional. Drop me an email and I will promptly and gladly rectify it.