I have a file that include a long string , I can calc the md5 of this file .

Is there any way to know which string I need to add for this file so the md5 of this file will be specific md5 that I want?

For example , if I have string 111222333444 the md5 of this string is 092d75d9d14011469f281795901bdd1b if I want the md5 of my string string will be f45b563d2ecf032da2ce3416ba8f518e I need add to this string AAAA , so the string will be 111222333444AAAA

  • $\begingroup$ Welcome to Cryptography. You are looking for an MD5 collision. This is rather off-topic here. $\endgroup$
    – kelalaka
    Feb 2 '19 at 22:10

No, there is not (a practical) way to create a specific md5 output.

Finding a specific md5 output value is known as a preimage attack. While md5 is very broken for collision resistance, the preimage resistance is still impractical. There are some papers with run times slightly less than the theoretical maximum, but these are still extremely expensive (e.g. cost $>2^{100}$). Your base string ("fixed prefix") may make some of the attacks not work, which will make it even more expensive to find an additional string to add.

Unless there is a theoretical breakthrough or you have an impossibly large compute farm to run an attack, you cannot directly calculate a string to and to get a specifc md5 output.

Additional Note: Even though md5 preimages are still impractical today, you should definitely not use md5. The analysis of md5 for collisions has advanced to the point where they are extremely cheap. Preimages aren't quite to that point yet, but there have been advances and there are replacement functions that are significantly stronger.


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.