UNext Editorial Team

Share

MD5 algorithm is basically used for finding the message digest. Basically what happens in MD5 algorithm is that every message is padded into blocks of 512bits each. There are basically 4 rounds of 16 operations each, which implies that in total we perform 64 operations in each block and the output of every block, is fed into the subsequent block. And again the process continues till the last block. The output of the last block is our message digest.

**Use of MD5 Algorithm****Working of the MD5 algorithm****Output message digest****Advantages of MD5 Algorithm****Disadvantages of MD5 Algorithm**

- It is used for the purpose of data verification in transmission protocols
- In many web applications, MD5 hash is used to prevent security breaches, hacking etc. by the way of enhancing security
- MD5 algorithm was developed mainly for the purpose of security as it takes any message and gives 128bit hash value as output.

There are 5 prominent steps in the working of the MD5 Algorithm. They are,

**Append padding bits**

Initially, when we get the message, it can be of any size say 5000bits, 12345bits, etc. For this message, we add some more bits, which are known as padding bits. And the thing to keep in mind is that bits are added in such a way that, the resultant total number of bits must be 64 bits short from becoming the multiple of 512. And when it comes to padding, we add 1 at the beginning and the rest 0’s.

**Append length bits**

In this step instead of padding bits, we add the length bits. Initially, in first step, we appended the message in such a way that the total number of bits in the message was 64bits short from becoming the multiple of 512. Now we add the length bits in such a way that the total number of bits in the message is perfectly the multiple of 512. That means 64bits; length bits to be precise are added to the message.

**Initialize MD buffer**

In this step, we use 4 buffers of 32 bits each. Let’s name this buffer as A, B, C and D respectively. The use of these buffers will be known in the coming steps. The buffers are to be initialised in this step. The way in which we initialize is given below

A = 0, 1, 2, 3, 4, 5, 6, 7

B = 8, 9, a, b, c, d, e, f

C = f, e, d, c, b, a, 9, 8

D = 7, 6, 5, 4, 3, 2, 1, 0

**Process each 512 bit block**

Previously it was said that there will be 64 processes, divided into 4 rounds of 16 processes. We use 4 different functions for 4 different rounds. The functions used here F, G, H and I respectively.

In the previous step, we had initialised the buffers namely A, B, C, and D. After the round operation, the output will also be A_{1}, B_{1}, C_{1,} and D_{1}.

The output of B will be fed into C_{1, }C into D_{1,} and D into A_{1}. A will also be fed into B_{1 }but after some process.

First, the output of B, C, and D are taken and the F function is applied to them. We will do the addition modulo by 2^{32} bits for the output of this with A. For this, we add the 32 bits message and again we do the addition modulo by 2^{32 }bits. Then we add a 32 bit constant to the output and once again addition modulo by 32bits. At last, we do left shift by s (s can be any value) and addition modulo by 2^{32}.

The result of this will be fed to b_{1}. Thus we got the output for all 4 buffers. This is one operation by using F function. There will be a total of 16 operations by using F function, and then 16 operations by using G, H and I functions to make it 64 in all.

The output we get here will be the starting block of the next 512 bit block.

This process goes on till the last block of 512 bit is processed. The output of the last 512 bit block is ultimately our message digest. The outputs we get are the blocks of 32 bit. So that makes 4 blocks of 32 bits, which ultimately means 128 bit output. So here we feed 512 bit and get 128 bit as our output.

- MD5 algorithm is very much helpful as it is a bit easier for storing and comparing smaller hashes than the large text of variable length.
- They are used to store passwords in 128-bit form in UNIX.
- And it’s easy to develop a message digest from the original message.

- One condition for MD5 Algorithm is that it should not be possible to create the same hash function for 2 different inputs. But this was possible which adds to its disadvantage.
- MD5 is also known to be slow when compared to other algorithms such as SHA-I

Though there are disadvantages in using MD5 algorithm, we should also focus on the merits by the use of this algorithm. This is indeed faster and easier to use. And many developments are on its way.

So, have you made up your mind to make a career in Cyber Security? Visit our **Master Certificate in Cyber Security (Red Team)** for further help. It is the first program in offensive technologies in India and allows learners to practice in a real-time simulated ecosystem, that will give them an edge in this competitive world.

Want To Interact With Our Domain Experts LIVE?