Saturday, February 2, 2013

MD5 Algorithm

MD5 (Message Digest 5) Algorithm:

Message Digest generation using MD5 –
1.     Append Padding bits:
Length  448 mod 512
The message is padded so that its length congruent to 448 mod 512. That is the length of padded message is 64 bits less than an integer multiple of 512 bits.
For ex:     If the message is 448 bits long. It is padded by 512 bits of a length of 966 bits. Padding is always added even the message is already of the desired length.
2.     Append length:
If the original length is greater than 264 then only the low order 64 bits of the length are used so the field contains the length of the original message mod 264.
      The output of first two steps feeds a message i.e. an integer multiple of 512 bits so the total length of expanded message is L x 512 bits.
3.     Initialize MD Buffer:
A 128 bit buffer is used to hold intermediate and final results. The buffer is represented by four 32 bit registers and they are initialized as –

A= 67452301
B=EFCDAB89
C=98BADCFE
D=10325476


These values are stored in the following format which is known as Little Endian Format –

Little Endian Format
WORD A
01234567
WORD B
89ABCDEF
WORD C
FEDCBA98
WORD D
76543210






4.     Process message in 16 bits word Blocks:
The heart of the algorithm is the compression function that consists of four rounds. This is shown in figure by HMD5.
      Each round takes the current 512 bit block being processed Yq and the 128 bit buffer value ABCD.
      Each round also makes use of ¼ of 64 element table T[1,............,64].
      Output of the fourth round is added to the first round i.e. CVq to produce CVq+1 .

0 comments:

Post a Comment

Powered by Blogger.