I have the following requirement for hashing using MD5.


Where values A,B & C are given. However X is not given.

I would like to find out what value of X would give a hash beginning with 32 1's bits

meaning H(A,B,C,X) = Begin with 32 '1' bits

I can brute force by testing all kinds of characters of X till i get 32 '1' bits.

however is there a faster way rather than doing this?

  • $\begingroup$ Short answer: No, there isn't. So use brute-force. But if you use a GPU it'll just take a few seconds to find such an $X$. $\endgroup$ Nov 4, 2012 at 17:00
  • $\begingroup$ Are A, B, C, X arbitrary length strings, or is there a length limit? $\endgroup$ Nov 4, 2012 at 20:09
  • $\begingroup$ A,B,C are fixed strings where as X can be any characters up to 100 characters of length $\endgroup$
    – null
    Nov 5, 2012 at 1:01

2 Answers 2


Short answer: no you can't, MD5 is not that broken.

Long answer: if you really need to do that, a laptop i5 is able to try 5 millions of MD5 hashes per second; on average you will have to try 2^32 ~ 4300 millions hashes, so that it will be a matter of minutes on any decent remotely-modern CPU.

  • $\begingroup$ With a GPU it's even faster, taking only a few seconds. See oclHashcat performance $\endgroup$ Nov 5, 2012 at 11:34
  • $\begingroup$ @CodesInChaos looking into that now. this crack is taking me forever with brute force $\endgroup$
    – null
    Nov 5, 2012 at 18:51

After much research you can actually use CUDA to program your program to run with GPU, which is super fast.

Alternatively you can run your program directly using your graphics card utility. Example given at the site: http://acer-scandic.custhelp.com/app/answers/detail/a_id/9073/~/assigning-a-graphics-card-to-an-application-with-nvidia-optimus

This is slightly faster than just running your brute force program as per normal.


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.