MD-5 2
MD-5 2
INTRODUCTION
MD-5 is quite fast and produces a 128 bit message digest.
The input text is processed in 512 bit blocks which are further divided into 16 (32
bit sub blocks)
The output of the algorithm is a set of 4 32 bit blocks which make up the 128 bit
message digest.
WORKING OF MD-5
Step 1:Padding
The aim of this step is to make the length of the original message equal to a value
which is 64 bits less than the exact multiple of 512 bits.
Suppose we are given a message of 1000 bits. Now we have to add padding bits
to the original message. Here we will add 472 padding bits to the original
message. After adding the padding bits the size of the original message/output of
the first step will be 1472 i.e. 64 bits less than an exact multiple of 512 (i.e. 512*3
= 1536).
The padding consists of single 1 bit followed by all 0s as required.
Note:Padding bits are always added even if the length is already 64 bits less
than an exact multiple of 512
Step 2: Append Length
After padding bits are added , the next step is to calculate the length of the original
message in terms of 64 bits (2^ 64 ) which is then appended at the end of the
original message + padding.
Data to be hashed
512 bits
Step 3:Divide the input into 512 blocks
After all the initializations, the real algorithm begins.There is a loop that runs as many
512 bi blocks as follows:
5.1 Copy the four chaining variables into four variables a,b,c,d.
A=a,B=b,C=c,D=d
5.2 Divide the current 512 block into 16 sub blocks.Thus each sub block contains 32 bits
5.3 We have 4 rounds.In each round we process all the 16 sub block belonging to a
block.The inputs to each round are:
Round 2
Round 4