MD5 Demo:

This demonstrates the padding technique used for MD5 and explains how MD5 works.

Enter a message in the text box below.



Below is a bit level representation of your message.



Your message contains bits. The message will be padded to make it 448 mod 512 bits long. Since your message is we will add because: MOD 512 = We will add ONE 1 and ZEROS. After this operation a 64 bit value which represents the original length of the message is added. For this particular message the input value added will be . So the message after all appending operations are complete will look like, at the bit level the text box below. If you look at the end of message you should be able to identify the added bits.


A 128 bit buffer (4 registers) is used to hold the intermediate and final result of the hash function. They are initialized to the following values:

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

At this point the message is passed in blocks of 512 bits through the the compression function as seen below:
MD5 compression function
Figure taken from Cryptography and Network Security: Principles and Practice by William Stallings

After all the 512 bit blocks have been processed a 128 bit message digest is produced, which is a function of all the bits of your message.

The operations of the Functions F, G, H, I can be expressed by the following diagram:
Elementary MD5 Operation
Figure taken from Cryptography and Network Security: Principles and Practice by William Stallings

where g can be expressed as:

ROUND 1: (b AND c) OR (b` AND d)
ROUND 2: (b AND d) OR (c AND d`)
ROUND 3: b + c + d
ROUND 4: c + (b OR d`)


This was created as part of the Cryptography Module of NSF Award No. 0113627: "Increasing Security Expertise in Aviation-oriented Computing Education: A Modular Approach", at Embry-Riddle Aeronautical University in Prescott, Arizona.

Created by Nathaniel Alderson


Project InfoModulesLinksPapersTeamNSF

Last update: August 1, 2002