I have a situation where I would like to reverse a hash which is the MD5 of a concatenation of 76 characters. I know the first 44 characters but don't know the remaining 32 characters. A description of the problem is as follows:

Hash = MD5 (cat (known_string_of_length_44chars, unknown_string_of_length_32chars))

I can generate Hash values for multiple combinations of the known_string. I would like to determine the unknown_string. Can this be done? Is brute forcing a possibility?

  • 3
    $\begingroup$ brute-forcing is always a possibility (and in this case may take up to $2^{32\cdot 8}=2^{256}$ operations, so you better know more about the character than them being just unknown bytes). $\endgroup$
    – SEJPM
    Commented Oct 6, 2017 at 9:48
  • 1
    $\begingroup$ Forget about it unless you known something quite specific about unknown_string_of_length_32chars, or can obtain some additional information. Even if you knew that it is lowercase hexadecimal (4 entropy bits per char), that won't cut it: you won't brute-force 128-bit anytime soon. $\endgroup$
    – fgrieu
    Commented Oct 6, 2017 at 11:11

2 Answers 2


You have two problems, the first is the computational complexity of preimage attack on MD5. It is currently around 2^123 Pre-image attack on MD5 hash This is technically better than brute force but way outside what is feasible in the forseeabile future. But perhaps worse than that is the information theory limit. A preimage attack will find a pre-image, not the pre-image which was originally used. With 32 chars you get a space of 256 bi, far more than 128 bits of MD5. This means there are expected to be many preimages of the required form. This means if you want to find the original as opposed to just any value with the correct form and correct hash it is impossible even with infinite computing power. The same thing also shows us that requiring a pre image of such a form can't improve the pre image attack complexity as we could have picked any prefix and still expect many solutions. If you could have limited to a small preimage space you could brute force it. And if the space had some special form the knowledge that a solution of a special form exist could theoretically make the attack even faster.


Assuming the characters are random, single-byte values, you're out of luck.

You would need to brute-force a 32-byte key-space, which is 256 bits… a task that is pretty much impossible.

(If you want a short overview of just how impossible, see here.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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