How does the MD5 Algorithm works?

Information SecuritySafe & SecurityData Structure

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 264 = 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 264. 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 (Yq) 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.

raja
Updated on 14-Mar-2022 07:45:50

Advertisements