Hash functions can have collisions. It's almost trivial to compute data that has a matching MD5 hash to the original. Consider critical data that must not be altered in transit and assume that only the data, and not the checksum, can be altered. Also assume that anybody can access the data.
Which of these would be a good way to go about creating a checksum of the data (Or if there's a better way, that would be great too)?
- Using multiple hash functions on the data and concatenating them. Surely having multiple hashes would make it hard for an attacker to generate data that causes a collision in all of the hash functions?
- Use HMAC with SHA512 (Key-length attack mitigation) and share the secret along with the generated hash. This secret will not change for this file, so the secret will be the same for all those who obtain it.
Thanks
assume that only the data, and not the checksum, can be altered
Again a (nonsensical) homework, right?