10-10-2010, 10:49 PM
Hi, it's nice to hear from you that my idea was usefull (even only a little bit, but everything counts ) 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
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...
Is it possible to have access to your source code?
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
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...
Is it possible to have access to your source code?