MD5 algorithm Research (2)

Source: Internet
Author: User
Tags constant final md5
Algorithm FF (B,C,D,A,M3,22,0XC1BDCEEE)
FF (A,B,C,D,M4,7,0XF57C0FAF)
FF (D,A,B,C,M5,12,0X4787C62A)
FF (c,d,a,b,m6,17,0xa8304613)
FF (b,c,d,a,m7,22,0xfd469501)
FF (A,B,C,D,M8,7,0X698098D8)
FF (D,A,B,C,M9,12,0X8B44F7AF)
FF (C,D,A,B,M10,17,0XFFFF5BB1)
FF (B,C,D,A,M11,22,0X895CD7BE)
FF (a,b,c,d,m12,7,0x6b901122)
FF (d,a,b,c,m13,12,0xfd987193)
FF (c,d,a,b,m14,17,0xa679438e)
FF (b,c,d,a,m15,22,0x49b40821)

Second round

GG (a,b,c,d,m1,5,0xf61e2562)
GG (d,a,b,c,m6,9,0xc040b340)
GG (C,D,A,B,M11,14,0X265E5A51)
GG (B,C,D,A,M0,20,0XE9B6C7AA)
GG (A,B,C,D,M5,5,0XD62F105D)
GG (d,a,b,c,m10,9,0x02441453)
GG (c,d,a,b,m15,14,0xd8a1e681)
GG (B,C,D,A,M4,20,0XE7D3FBC8)
GG (A,B,C,D,M9,5,0X21E1CDE6)
GG (D,A,B,C,M14,9,0XC33707D6)
GG (c,d,a,b,m3,14,0xf4d50d87)
GG (b,c,d,a,m8,20,0x455a14ed)
GG (a,b,c,d,m13,5,0xa9e3e905)
GG (D,A,B,C,M2,9,0XFCEFA3F8)
GG (C,D,A,B,M7,14,0X676F02D9)
GG (B,C,D,A,M12,20,0X8D2A4C8A)

Third round

HH (a,b,c,d,m5,4,0xfffa3942)
HH (d,a,b,c,m8,11,0x8771f681)
HH (c,d,a,b,m11,16,0x6d9d6122)
HH (b,c,d,a,m14,23,0xfde5380c)
HH (A,B,C,D,M1,4,0XA4BEEA44)
HH (D,A,B,C,M4,11,0X4BDECFA9)
HH (C,D,A,B,M7,16,0XF6BB4B60)
HH (B,C,D,A,M10,23,0XBEBFBC70)
HH (A,B,C,D,M13,4,0X289B7EC6)
HH (D,A,B,C,M0,11,0XEAA127FA)
HH (c,d,a,b,m3,16,0xd4ef3085)
HH (B,C,D,A,M6,23,0X04881D05)
HH (a,b,c,d,m9,4,0xd9d4d039)
HH (D,A,B,C,M12,11,0XE6DB99E5)
HH (C,D,A,B,M15,16,0X1FA27CF8)
HH (b,c,d,a,m2,23,0xc4ac5665)

Fourth round

II (a,b,c,d,m0,6,0xf4292244)
II (D,A,B,C,M7,10,0X432AFF97)
II (C,D,A,B,M14,15,0XAB9423A7)
II (b,c,d,a,m5,21,0xfc93a039)
II (A,B,C,D,M12,6,0X655B59C3)
II (d,a,b,c,m3,10,0x8f0ccc92)
II (c,d,a,b,m10,15,0xffeff47d)
II (B,C,D,A,M1,21,0X85845DD1)
II (a,b,c,d,m8,6,0x6fa87e4f)
II (D,A,B,C,M15,10,0XFE2CE6E0)
II (c,d,a,b,m6,15,0xa3014314)
II (B,C,D,A,M13,21,0X4E0811A1)
II (a,b,c,d,m4,6,0xf7537e82)
II (d,a,b,c,m11,10,0xbd3af235)
II (C,D,A,B,M2,15,0X2AD7D2BB)
II (b,c,d,a,m9,21,0xeb86d391)

Constant TI can be selected as follows:

In step I, TI is the integral part of 4294967296*abs (sin (i)), and the unit of I is radians. (4294967296 equals 2 of 32 parties)
After all this is done, add a, B, C, D, respectively. The algorithm is then continued with the next grouped data, and the final output is cascaded by a, B, C, and D.

When you implement the MD5 algorithm as I said above, you can use the following information to make a simple test of your program to see if there are errors in the program.

MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661
MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72
MD5 ("message digest") = F96b697d7cb7938d525a2f31aaf161d0
MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b
MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =
d174ab98d277d9f5a5611c2c9f419d9f
MD5 ("123456789012345678901234567890123456789012345678901234567890123456789
01234567890 ") = 57edf4a22be3c955ac49da2e2107b67a

If you use the above information to test your MD5 algorithm example, the final conclusion and the standard answer exactly the same, then I will be here like you say a congratulations. You know, my program did not get the same result as it did when the first compilation was successful.


Security of MD5

MD5 relative to MD4 improvements:

1. increased the fourth round;

2. Each step has a unique additive constant;

3. To weaken the symmetry of function g in the second round from (x&y) | (x&z) | (y&z) into (x&z) | (y& (~z));

4. The first step, coupled with the results of the previous step, will lead to a faster avalanche effect;

5. Changed the order of accessing message subgroups in the second and third rounds to make them more dissimilar;

6. Approximate optimization of the cyclic left shift in each round to achieve a faster avalanche effect. The displacement of each wheel is different.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.