# Finding partial pre-image of MD5 hash

I have the following requirement for hashing using MD5.

H(A,B,C,X);

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?

-
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$. – CodesInChaos Nov 4 '12 at 17:00
Are A, B, C, X arbitrary length strings, or is there a length limit? – Paŭlo Ebermann Nov 4 '12 at 20:09
A,B,C are fixed strings where as X can be any characters up to 100 characters of length – null Nov 5 '12 at 1:01

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.

-

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.

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