MD5 speed improvement ideas
#10
Hi, sorry, i don't have much time now, so briefly another tip. Again, 'clever' compiler may optimize it for you, but your code doesn't look like compiler do the job well.

First two steps of round 3:
a += ((b ^ c) ^ d) + const + pass;
a = ((a<<const) | (a>>(32-const)) ) + b;

d += (a ^ (b ^ c)) + const + pass;
d = ((d<<const) | (d>>(32-const)) ) + a;

Optimized first two steps of round 3:
tmp = b ^ c;
a += (tmp ^ d) + const + pass;
a = ((a<<const) | (a>>(32-const)) ) + b;

d += (tmp ^ a) + const + pass;
d = ((d<<const) | (d>>(32-const)) ) + a;

You can rewrite all pair steps in round 3 in that manner (i.e. computing tmp in each (2n)th step and use it in each (2n+1)th step. Just for sure, variable tmp should be declared as 'register' to avoid writing and reading 'tmp' to/from memory.

I'm not familiar with IRC yet, so maybe I'll join later. I'm using jabber for now.
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