PHP Strings Primer - Verifying Integrity
(Page 35 of 37 )
One of the most common uses for hashes, or checksums, is to verify that data has not been modified. Many times when you are downloading a program, the author may provide a md5 hash or crc32 checksum. This allows you to download the code for the program and then verify that it has not been modified since the author created the hash. You do this by generating a hash yourself and then comparing it to the one supplied by the author.
All these different functions allow you to accomplish this. Though the most commonly used way is a md5 hash. You, obviously, will need to generate a hash using the same algorithm that the author did. Otherwise, you will never have a matching pair.
The 'md5_file()' function is extremely useful in this area because it does not require that the data be present in a string. It will generate an md5 sum of a specified file. This can be useful for generating md5 hashes on the fly.
Next: User Authentication >>
More Programming Basics Articles
More By Matt Wade