I've been reading the wikipedia page, trying to get a better understanding of how to produce a collision.


The wikipedia page above states: "two colliding files is a template file with a 128-byte block of data, aligned on a 64-byte boundary that can be changed freely"

What does 64-byte boundary mean, Does that mean I can't change byte 64 but I can change the other bytes in the 128-byte block of data?

Furthermore, how do I verify that two different files generates the same md5 without using a program, just by looking at the bits? (This part is a homework question, if you guys can point me in the right direction, that would be great).

  • 1
    $\begingroup$ As for the second question, I don't think that that is feasible in the general sense. Maybe you could check if they are block aligned and end with a similar block, but in general you should only be able to detect identical files. It also depends what you mean with "just looking at the bits". If that means that your brain should not be involved, then you can't. $\endgroup$ – Maarten Bodewes Sep 22 '13 at 15:09

They mean that you send a message template to anybody you want to fool, say, a certificate request to a certificate authority. You make sure that the MD5 is calculated over N 64 byte blocks of data generated by the other party, and then the 128 byte block you pre-calculated.

Now you receive back the data generated by the other party, ending with your 128 byte block, aligned on 64 bytes. In our example that would be a certificate. Now you can simply replace all the data generated by the other party, recalculate your 128 byte block and get the same MD5.

The other party, for instance the certificate authority, could use the generated MD5 to generate an MD5 with RSA signature. As the signature only depends on the private key of the other party and the MD5, the signature would be valid for both the original and the "fake" certificate.

| improve this answer | |
  • 1
    $\begingroup$ I once made two batch files that ended with such a precalculated block, data that was simply ignored. I changed a single bit (ASCII 0 to ASCII 1) to make the batch files do two different things altogether, using an if statement on the value. Then I regenerated the block. In my sample I printed out two entirely different texts, even though the MD5 was exactly the same. Very informative, but the virus scanner of my company made sure my backup was completely destroyed, as it also contained a sample virus :) McAfee can scan all the files from a .zip, but it can only destroy a full .zip... $\endgroup$ – Maarten Bodewes Sep 22 '13 at 15:06
  • 2
    $\begingroup$ The block size of MD5 is 512 bits or 64 bytes not 64 bits. $\endgroup$ – CodesInChaos Sep 23 '13 at 9:22
  • $\begingroup$ @CodesInChaos & all fixed this in answer, it was more or less a problem between brain and keyboard :) $\endgroup$ – Maarten Bodewes Oct 1 '13 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.