MD5 speed improvement ideas
#6
Hi, it's nice to hear from you that my idea was usefull (even only a little bit, but everything counts Wink ) Thanks. Here is another tip. Very simple and 'standard'.

You can get rid of adding constant to constant at each pass... For example at first step of MD5, everything except the first part of password is known.

In the first step, there is :

a += (const ^ (const & (const ^ const))) + const + password[0];
a = ((a<<const) | (a>>const)) ) + const;

You should precompute as much as possible. So it means that you can avoid initializing a,b,c,d variables by values 0x67452301, 0xEFCDAB89 etc. then adding, xoring them with another constants etc. First four steps for example can look like this:

a = 0xd76aa477 + password[0];
a = ((a<<7) | (a>>25) ) + 0xEFCDAB89;

d = (0x98BADCFE ^ (a & 0x77777777)) + 0xf8fa0c4c + password[1];
d = ((d<<12) | (d>>20) ) + a;

c = ((d & a) | (~d & 0xEFCDAB89)) + 0xbcdb4dd9 + password[2];
c = ((c<<17) | (c>>15) ) + d;

b = ((c & d) | (~c & a)) + 0xb18b7a77 + password[3];
b = ((b<<22) | (b>>10) ) + c;

Hope I didn't do any 'typo', but I think that you got the point Wink

The same can be done from the end - hashes could be precalculated (reversed) much or less, depending on type of attack, but it is another story... Smile

Is it possible to have access to your source code?
Reply


Messages In This Thread
MD5 speed improvement ideas - by Dalibor - 10-09-2010, 08:54 PM
RE: MD5 speed improvement ideas - by D3ad0ne - 10-09-2010, 10:37 PM
RE: MD5 speed improvement ideas - by Dalibor - 10-10-2010, 09:00 AM
RE: MD5 speed improvement ideas - by ksp - 10-10-2010, 09:54 AM
RE: MD5 speed improvement ideas - by atom - 10-10-2010, 10:53 AM
RE: MD5 speed improvement ideas - by Dalibor - 10-10-2010, 10:49 PM
RE: MD5 speed improvement ideas - by atom - 10-11-2010, 12:37 PM
RE: MD5 speed improvement ideas - by Dalibor - 10-11-2010, 10:46 PM
RE: MD5 speed improvement ideas - by atom - 10-13-2010, 10:14 AM
RE: MD5 speed improvement ideas - by Dalibor - 10-14-2010, 03:02 PM
RE: MD5 speed improvement ideas - by atom - 10-15-2010, 01:11 PM
RE: MD5 speed improvement ideas - by atom - 10-15-2010, 03:26 PM
RE: MD5 speed improvement ideas - by Dalibor - 10-16-2010, 12:43 AM
RE: MD5 speed improvement ideas - by D3ad0ne - 10-16-2010, 12:33 AM
RE: MD5 speed improvement ideas - by atom - 10-17-2010, 10:42 AM
RE: MD5 speed improvement ideas - by Dalibor - 10-17-2010, 04:19 PM
RE: MD5 speed improvement ideas - by IvanG - 10-17-2010, 08:12 PM
RE: MD5 speed improvement ideas - by Dalibor - 11-01-2010, 11:15 AM
RE: MD5 speed improvement ideas - by Rolf - 10-17-2010, 04:55 PM
RE: MD5 speed improvement ideas - by D3ad0ne - 10-17-2010, 07:33 PM
RE: MD5 speed improvement ideas - by IvanG - 12-14-2010, 06:55 PM