MD5 algorithm description (Turn)

Source: Internet
Author: User
Tags md5
MD5 Algorithm Description
1, MD5 algorithm is the input of the data to complement, so that if the data bit length Len to 512 of the result is 448.
That is, the data is extended to k*512+448 bits. That is, k*64+56 Byte, K is an integer.
Specific complement operation: Fill a 1, and then fill 0 to meet the above requirements
2, fill the length of the data:
The original length B of the data is represented by a 64-digit number, and B is represented by two 32 digits. The data is then filled
Make up a multiple of 512 digits in length.
3. Initialize MD5 parameters
Four 32-bit integers (a,b,c,d) are used to compute the information digest, initialized with a hexadecimal-represented number
a=0x01234567
B=0x89abcdef
C=0xfedcba98
d=0x76543210
4, the processing bit operation function
X,y,z is a 32-bit integer.
F (x,y,z) = x&y| Not (X) &z
G (x,y,z) = x&z| Y Not (Z)
H (x,y,z) = X xor Y xor Z
I (x,y,z) = Y xor (X|not (Z))
5, the main transformation process:
Use constant group t[1 ... ], T[i] is a 32-bit integer in 16-digit notation, with 16 32-bit integers for the data
Number Array m[] represents.
The specific process is as follows:
* * Processing Data Original/*
For i = 0 to N/16-1 do
* Each time, the original data is stored in an array x of 16 elements. */
For j = 0 Todo
Set X[j] to m[i*16+j].
End/ending loop to J
/* Save A as AA, B as BB, C as CC, and D as DD.
*/
AA = A
BB = B
CC = C
DD = D
/* 1th Round * *
/* with [ABCD K S] to represent the following operations
A = B + ((A + F (b,c,d) + x[k] + t[i]) <<< s). */
/* Do the following operations. */
[ABCD 0 7 1] [DABC 1 12 2] [Cdab 2 17 3] [BCDA 3
22 4]
[ABCD 4 7 5] [DABC 5 12 6] [Cdab 6 17 7] [BCDA 7

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.