cr-marcstevens / hashclash

Project HashClash - MD5 & SHA-1 cryptanalysis
Other
742 stars 87 forks source link

Chosen Prefix Collision requirement for matching prefix size #16

Closed Kriskras99 closed 3 years ago

Kriskras99 commented 3 years ago

Hi! Thank you for this amazing tool.

I've succesfully calculated hundreds of identical prefix collisions (trying to get the md5 hash on the pdf itself). I've been looking into the CPC and was wondering why the prefix size needs to match. With my limited understanding of the hash collisions I would expect the prefix size not the matter as long as you pad both prefixes to a hash block boundary. Could you explain where the same size requirement comes from? Or point me in the right direction?

Thank you!

cr-marcstevens commented 3 years ago

Hi Kris,

MD5 puts the total message length in the very last block. If the prefixes don't have the same length then so do the final messages. So even if you get a internal collision r blocks before the end, the MD5 padding will be different and kill the collision property.

Cheers Marc

On July 10, 2021 11:21:34 AM GMT+02:00, Kriskras99 @.***> wrote:

Hi! Thank you for this amazing tool.

I've succesfully calculated hundreds of identical prefix collisions (trying to get the md5 hash on the pdf itself). I've been looking into the CPC and was wondering why the prefix size needs to match. With my limited understanding of the hash collisions I would expect the prefix size not the matter as long as you pad both prefixes to a hash block boundary. Could you explain where the same size requirement comes from? Or point me in the right direction?

Thank you!

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/cr-marcstevens/hashclash/issues/16

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

Kriskras99 commented 3 years ago

Ah, that explains it. Thank you very much!