by mccr8 · 9y ago · 0 comments
edit: as versteegen points out it's 320 bytes, not 304.
https://news.ycombinator.com/item?id=13716581
I learned a lot from it. One thing is that this property is true of any Merkle-Damgård-type hash if the hash internal state is the same size as the hash digest. This is true of SHA-1 and of several other famous and widely-used hashes, but not true of every hash, including some of the most recent designs like several SHA-3 candidates and SHA-3 itself. In a hash without this property, you can have a collision condition H(X)=H(Y) (and len(X)=len(Y)) yet typically H(X+a)≠H(Y+a).
Edit: len(X)=len(Y) is also necessary because Merkle-Damgård hashes encode the message length into internal padding, so if you happened to have two colliding inputs that were different lengths, they will generally not produce a collision when the same string is added to each.
It's why you don't use a bare hash as authentication, but instead use a HMAC.
goto showImage1;
showImage1:
renderImage1();
exit
showImage2:
renderImage2();
exit
If an attacker can hash a block that means "goto showImage1" and "goto showImage2" with the same hash, then you can see that the contents of those images doesn't matter, as long as the data for those images occurs after the logic for choosing them.(and no that's not what this attack does in reality, but just a logical framework for understanding why the images don't matter)