I know this is a strange question, and I know that md5sum is nearly impossible to break... but I'm just wondering if someone here knows if it is possible to recreate a file given it's md5sum hash?

I mean, not necessarily the same file as the original but a file that would equate to the same md5sum hash. So far, I don't see any result from Google


It is possible to find a file that has a given MD5 hash, but it is not possible to produce such a file from the hash itself.

| improve this answer | |
  • +1 See: Trapdoor function & one-way function. – JZeolla Jan 10 '13 at 13:00

A unique MD5 hash can be produced by an infinite number of files, as there is only 2^128 unique hashes but there are infinite files of infinite length (theoretically).

To create a file from an MD5 hash would take a large amount of effort! You would have create a sequence of unique files and generate the MD5 hash for each one until you found a match. Certainly possible to 'brute force' your way through.

However your task would be considerably easier if you had the original file that the hash was produced with. There are several known flaws with MD5 and it is possible to create slightly different files for the same hash. MD5 is not unbreakable as you say.

| improve this answer | |

Theoretically, it is possible! As user1129682 said, there is only 2^128 different MD5 hashes. Now, you can use a method of exhaustion to find a file with a specified MD5. e.g. You can generate a file with its contents as N "1"s and calculate its MD5. Increase N from 1 to infinity, then you will find at least a file with the predefined MD5. Of course, how long you can get it is unknown.

| improve this answer | |
  • 2
    That's not "create". – Ignacio Vazquez-Abrams Jan 10 '13 at 12:57
  • @IgnacioVazquez-Abrams No, it's fair game. However, this method is useless in practice. If you're willing to spend the current age of the universe (a little under 1 billion billion seconds) enumerating possibilities, using a billion computers, each computer would have to perform about a trillion operation per second. Also, it is not guaranteed that there is a file containing only 1 bits with a particular MD5, you may need to put 0 bits as well. (It's not even known if all 16-byte blobs are the MD5 of some payload.) – Gilles 'SO- stop being evil' Jan 10 '13 at 23:02

It is possible to create a file given a hash value. However, if you have a file and create a MD5 hash this process will not recreate that file but create a small file filled with gibberish.

| improve this answer | |

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.