- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# How does the MD5 Algorithm works?

There are the following steps are performed to compute the message digest of the message which are as follows −

**Step 1 − Append padding bits**− The message is continued or padded in such a method that its total length in bits is congruent to 448 modulo 512. This operation is continually implemented even if the message's length in bit is originally congruent to 448 modulo 512. 448 + 64 = 512, therefore the message is padded such that its length is now 64 bits less an integer multiple of 512.**Step 2 − Append length**− A 64 bit description of the length in bits of the original message M (before the padding bits were inserted) is added to the result of step 1. If the length of the original message is higher than 2^{64}= 184 467 440 73 709 551 616, therefore only the low order 64 bits of the length of message M are utilized.Therefore, the field includes the length of the original message M modulo 2

^{64}. These bits are added as two 32 bit words and added low-order (least significant) word first. The result of step 1 and step 2 is a message with a length in bits that is an integer multiple of 512 bits.**Step3 − Initialize MD Buffer**− A 128-bit buffer can be used to hold intermediate and last result of the MD5 hash algorithm. A four-word buffer (A, B, C, and D) can be used to evaluate the message digest. Therefore, each A, B, C, D is a 32-bit register.These registers are boot up to the following values in hexadecimal, low-order bytes first −

Word A: 01 23 45 67

Word B: 89 ab cd ef

Word C: fe dc ba 98

Word D: 76 54 32 10

**Step 4 − Process message in 512 bit (16-word) blocks**− A compression function includes four rounds of processing. Each round creates an input the current 512-bit block being processed (Y_{q}) and the 128-bit buffer value ABCD and update the element of buffer.It can describe four auxiliary functions that each create as input three 32-bit words and generate as output one 32-bit word.

F (X, Y, Z) = XY v not (X) Z

G (X, Y, Z) = XZ v Y not (Z)

H (X, Y, Z) = X xor Y xor Z

I (X, Y, Z) = Y xor (X v not (Z))

In each bit position, F acts as conditional: If X then Y else Z. The function F can have been represented using + instead of v since XY and not X(Z) will never have 1’s in the similar bit position.

**Step5 − Output**− The message digest created an output including A, B, C, D. The output from the final round is the 128-bit hash result or message digest it can acquired after it can have incrementally processed all t 512-bit blocks of the message.

- Related Articles
- How does Secure Hash Algorithm works?
- What is the Uses of MD5 Algorithm?
- What are the application of MD5 Algorithm?
- How Binary Classification Tree Algorithm Works
- How does digital thermometer works?
- How does jQuery event namespace works?
- How does JavaScript focus() method works?
- How does the java "for each" loop works
- How does the k-means algorithm work?
- What is Domain Generation Algorithm (DGA)? (How It Works, How to Detect?)
- How does == operator works in Python 3?
- How does Constraint Layout works in android?
- How does DES works in Information Security?
- How does Steganography works in Information Security?
- How does Hibernate Second Level Cache Works?