Fractal MD5 and collision probability

I wonder how safe it is to hash a bunch of MD5 hash values ​​to create a new hash, or will it increase the chance of collisions in any way.

Background: I have several files with dependencies. Each file has an associated hash value, which is calculated based on its contents. Let us call this hash value "single file". In addition to this, the file must also have a hash value that includes all dependent files, the hash value of "multi-file".

So the question is: can I just take all the MD5 hash values ​​of one dependent file, merge them, and then calculate the MD5 from the concatenated values ​​to get the hash value of the multi-file. Or this will result in an MD5 hash file, which is more likely to collide than if I combined the contents of all the dependent files.

Alternatively, is it possible to map the hash values ​​of the same file together to generate a multi-factor hash value, or can this lead to more conflicts?

+7
source share
3 answers

Sounds like you need a Merkel Tree

+3
source

MD5 has a lot of conflict issues, see the MD5 entry on Wikipedia .

However, if you are using MD5 not for security, but as a unique marker for dependency checking, even hashing concatenated hashes should be fairly safe.

Or, if not too late, switch to SHA-1.

+1
source

I think the risk of collision is about the same for hashing concatenated files, as for hashing concatenated file hashes.

+1
source

All Articles