Download presentation
Presentation is loading. Please wait.
1
MD5 Generation Auto-Generated Slides To Visualize MD5 Hash Generation by Chris Fremgen
2
MD5 Hashing Summary MD5 is a function used in cryptography to ensure data integrity. The idea of hashing is to create a unique code for a set of data through the use of functions. It was created by Ronald Rivest in 1991 and each message digest is 128 bits long. You can find more details in RFC 1321. There are two main steps in generating an MD5 digest. Pre-processing of data, and hash generation.
3
MD5 Data Preprocessing Preprocessing: First we need two unsigned integer arrays with 64 items in each. Lets use 'r' for the rotational array and 'k' for the constant array r[ 0..15] := {7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22} r[16..31] := {5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20} r[32..47] := {4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23} r[48..63] := {6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21} Use the following formula to generate the constants: for i from 0 to 63 k[i] := floor(abs(sin(i + 1)) × (2 pow 32)) We also need 4 constant variables to start bit shifting (these are arbitrary but need to be the same in all MD5 generators) var int h0 := 0x67452301 var int h1 := 0xEFCDAB89 var int h2 := 0x98BADCFE var int h3 := 0x10325476 Pre-processing the data is as follows: 1) Convert the data to a byte array 2) Append '1' bit to the data 3) Append '0' bits until message length in bits is 64 bits short of being a perfect multiple of 512 4) Append bit length of unpadded message as 64- bit little-endian integer to message The pre-processing of the data is done. Now we just run the data through the functions.
4
MD5 Pseudo code For each 512-bit chunk of message break chunk into sixteen 32-bit little-endian words w[i] for(i=0;i<15;i++) /* Initialize hash value for this chunk: (recall h0,h1,h2,h3 were declared as constants earlier) */ var int a := h0 var int b := h1 var int c := h2 var int d := h3 /* Main loop: */ /* Here are the logic functions that define this algorithm */ for i from 0 to 63 if 0 ≤ i ≤ 15 then f := (b and c) or ((not b) and d) g := i else if 16 ≤ i ≤ 31 f := (d and b) or ((not d) and c) g := (5×i + 1) mod 16 else if 32 ≤ i ≤ 47 f := b xor c xor d g := (3×i + 5) mod 16 else if 48 ≤ i ≤ 63 f := c xor (b or (not d)) g := (7×i) mod 16 temp := d d := c c := b b := b + leftrotate((a + f + k[i] + w[g]), r[i]) a := temp h0 := h0 + a h1 := h1 + b h2 := h2 + c h3 := h3 + d After all rounds are complete, the message digest is h0 append h1 append h2 append h3
5
MD5 Generation From User Input User Input String: 'test' User Input Bytes: 116 101 115 116
6
MD5 Generation From User Input After Pre-Processing of data, Message Bytes: 116 101 115 116 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32 0 0 0 0 0 0 0 There will be 1 iteration(s) since the padded message size is 512 bits long
7
MD5 Generation Now we continue to crank through the 4 logic functions provided in the RFC Before we start the process the constant variables are as follows: h0: 1732584193 h1: 4023233417 h2: 2562383102 h3: 271733878
8
MD5 Generation Iteration 1: Step 1 a = d, d = c, c = b, b = previous resulting value a: (1732584193)01100111010001010010001100000001 b: (4023233417)11101111110011011010101110001001 c: (2562383102)10011000101110101101110011111110 d: (271733878)00010000001100100101010001110110 Data Block: (1953719668)01110100011100110110010101110100 R Constant: (7)00000000000000000000000000000111 Sin Value: (3614090360)11010111011010101010010001111000 Logic Function: (1732584193)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3738345774)11011110110100101010000100101110
9
MD5 Generation Iteration 1: Step 2 a = d, d = c, c = b, b = previous resulting value a: (271733878)00010000001100100101010001110110 b: (3738345774)11011110110100101010000100101110 c: (4023233417)11101111110011011010101110001001 d: (2562383102)10011000101110101101110011111110 Data Block: (128)00000000000000000000000010000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (3905402710)11101000110001111011011101010110 Logic Function: (271733878)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (259321260)00001111011101001110110110101100
10
MD5 Generation Iteration 1: Step 3 a = d, d = c, c = b, b = previous resulting value a: (2562383102)10011000101110101101110011111110 b: (259321260)00001111011101001110110110101100 c: (3738345774)11011110110100101010000100101110 d: (4023233417)11101111110011011010101110001001 Data Block: (0)00000000000000000000000000000000 R Constant: (17)00000000000000000000000000010001 Sin Value: (606105819)00100100001000000111000011011011 Logic Function: (2562383102)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (4051846421)11110001100000100100010100010101
11
MD5 Generation Iteration 1: Step 4 a = d, d = c, c = b, b = previous resulting value a: (4023233417)11101111110011011010101110001001 b: (4051846421)11110001100000100100010100010101 c: (259321260)00001111011101001110110110101100 d: (3738345774)11011110110100101010000100101110 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (3250441966)11000001101111011100111011101110 Logic Function: (4023233417)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3673324588)11011010111100100111110000101100
12
MD5 Generation Iteration 1: Step 5 a = d, d = c, c = b, b = previous resulting value a: (3738345774)11011110110100101010000100101110 b: (3673324588)11011010111100100111110000101100 c: (4051846421)11110001100000100100010100010101 d: (259321260)00001111011101001110110110101100 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (4118548399)11110101011111000000111110101111 Logic Function: (3738345774)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3316493568)11000101101011011010110100000000
13
MD5 Generation Iteration 1: Step 6 a = d, d = c, c = b, b = previous resulting value a: (259321260)00001111011101001110110110101100 b: (3316493568)11000101101011011010110100000000 c: (3673324588)11011010111100100111110000101100 d: (4051846421)11110001100000100100010100010101 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (1200080426)01000111100001111100011000101010 Logic Function: (259321260)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3081527673)10110111101011000110000101111001
14
MD5 Generation Iteration 1: Step 7 a = d, d = c, c = b, b = previous resulting value a: (4051846421)11110001100000100100010100010101 b: (3081527673)10110111101011000110000101111001 c: (3316493568)11000101101011011010110100000000 d: (3673324588)11011010111100100111110000101100 Data Block: (0)00000000000000000000000000000000 R Constant: (17)00000000000000000000000000010001 Sin Value: (2821735955)10101000001100000100011000010011 Logic Function: (4051846421)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (1208299738)01001000000001010011000011011010
15
MD5 Generation Iteration 1: Step 8 a = d, d = c, c = b, b = previous resulting value a: (3673324588)11011010111100100111110000101100 b: (1208299738)01001000000001010011000011011010 c: (3081527673)10110111101011000110000101111001 d: (3316493568)11000101101011011010110100000000 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (4249261313)11111101010001101001010100000001 Logic Function: (3673324588)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3915164233)11101001010111001010101001001001
16
MD5 Generation Iteration 1: Step 9 a = d, d = c, c = b, b = previous resulting value a: (3316493568)11000101101011011010110100000000 b: (3915164233)11101001010111001010101001001001 c: (1208299738)01001000000001010011000011011010 d: (3081527673)10110111101011000110000101111001 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (1770035416)01101001100000001001100011011000 Logic Function: (3316493568)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3534770831)11010010101100000101001010001111
17
MD5 Generation Iteration 1: Step 10 a = d, d = c, c = b, b = previous resulting value a: (3081527673)10110111101011000110000101111001 b: (3534770831)11010010101100000101001010001111 c: (3915164233)11101001010111001010101001001001 d: (1208299738)01001000000001010011000011011010 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (2336552879)10001011010001001111011110101111 Logic Function: (3081527673)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (979919679)00111010011010000110001100111111
18
MD5 Generation Iteration 1: Step 11 a = d, d = c, c = b, b = previous resulting value a: (1208299738)01001000000001010011000011011010 b: (979919679)00111010011010000110001100111111 c: (3534770831)11010010101100000101001010001111 d: (3915164233)11101001010111001010101001001001 Data Block: (0)00000000000000000000000000000000 R Constant: (17)00000000000000000000000000010001 Sin Value: (4294925233)11111111111111110101101110110001 Logic Function: (1208299738)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3894188465)11101000000111001001100110110001
19
MD5 Generation Iteration 1: Step 12 a = d, d = c, c = b, b = previous resulting value a: (3915164233)11101001010111001010101001001001 b: (3894188465)11101000000111001001100110110001 c: (979919679)00111010011010000110001100111111 d: (3534770831)11010010101100000101001010001111 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (2304563134)10001001010111001101011110111110 Logic Function: (3915164233)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (969404962)00111001110001111111001000100010
20
MD5 Generation Iteration 1: Step 13 a = d, d = c, c = b, b = previous resulting value a: (3534770831)11010010101100000101001010001111 b: (969404962)00111001110001111111001000100010 c: (3894188465)11101000000111001001100110110001 d: (979919679)00111010011010000110001100111111 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (1804603682)01101011100100000001000100100010 Logic Function: (3534770831)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (1883400534)01110000010000100110100101010110
21
MD5 Generation Iteration 1: Step 14 a = d, d = c, c = b, b = previous resulting value a: (979919679)00111010011010000110001100111111 b: (1883400534)01110000010000100110100101010110 c: (969404962)00111001110001111111001000100010 d: (3894188465)11101000000111001001100110110001 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (4254626195)11111101100110000111000110010011 Logic Function: (979919679)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (1822017627)01101100100110011100100001011011
22
MD5 Generation Iteration 1: Step 15 a = d, d = c, c = b, b = previous resulting value a: (3894188465)11101000000111001001100110110001 b: (1822017627)01101100100110011100100001011011 c: (1883400534)01110000010000100110100101010110 d: (969404962)00111001110001111111001000100010 Data Block: (32)00000000000000000000000000100000 R Constant: (17)00000000000000000000000000010001 Sin Value: (2792965006)10100110011110010100001110001110 Logic Function: (3894188465)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (473810963)00011100001111011100100000010011
23
MD5 Generation Iteration 1: Step 16 a = d, d = c, c = b, b = previous resulting value a: (969404962)00111001110001111111001000100010 b: (473810963)00011100001111011100100000010011 c: (1822017627)01101100100110011100100001011011 d: (1883400534)01110000010000100110100101010110 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (1236535329)01001001101101000000100000100001 Logic Function: (969404962)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (49921547)00000010111110011011111000001011
24
MD5 Generation Iteration 1: Step 17 a = d, d = c, c = b, b = previous resulting value a: (1883400534)01110000010000100110100101010110 b: (49921547)00000010111110011011111000001011 c: (473810963)00011100001111011100100000010011 d: (1822017627)01101100100110011100100001011011 Data Block: (128)00000000000000000000000010000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (4129170786)11110110000111100010010101100010 Logic Function: (1883400534)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3871123065)11100110101111001010011001111001
25
MD5 Generation Iteration 1: Step 18 a = d, d = c, c = b, b = previous resulting value a: (1822017627)01101100100110011100100001011011 b: (3871123065)11100110101111001010011001111001 c: (49921547)00000010111110011011111000001011 d: (473810963)00011100001111011100100000010011 Data Block: (0)00000000000000000000000000000000 R Constant: (9)00000000000000000000000000001001 Sin Value: (3225465664)11000000010000001011001101000000 Logic Function: (1822017627)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2501906144)10010101001000000000111011100000
26
MD5 Generation Iteration 1: Step 19 a = d, d = c, c = b, b = previous resulting value a: (473810963)00011100001111011100100000010011 b: (2501906144)10010101001000000000111011100000 c: (3871123065)11100110101111001010011001111001 d: (49921547)00000010111110011011111000001011 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (643717713)00100110010111100101101001010001 Logic Function: (473810963)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2706708624)10100001010101010001100010010000
27
MD5 Generation Iteration 1: Step 20 a = d, d = c, c = b, b = previous resulting value a: (49921547)00000010111110011011111000001011 b: (2706708624)10100001010101010001100010010000 c: (2501906144)10010101001000000000111011100000 d: (3871123065)11100110101111001010011001111001 Data Block: (1953719668)01110100011100110110010101110100 R Constant: (20)00000000000000000000000000010100 Sin Value: (3921069994)11101001101101101100011110101010 Logic Function: (49921547)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3706076175)11011100111001100011110000001111
28
MD5 Generation Iteration 1: Step 21 a = d, d = c, c = b, b = previous resulting value a: (3871123065)11100110101111001010011001111001 b: (3706076175)11011100111001100011110000001111 c: (2706708624)10100001010101010001100010010000 d: (2501906144)10010101001000000000111011100000 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (3593408605)11010110001011110001000001011101 Logic Function: (3871123065)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (151034077)00001001000000001001100011011101
29
MD5 Generation Iteration 1: Step 22 a = d, d = c, c = b, b = previous resulting value a: (2501906144)10010101001000000000111011100000 b: (151034077)00001001000000001001100011011101 c: (3706076175)11011100111001100011110000001111 d: (2706708624)10100001010101010001100010010000 Data Block: (0)00000000000000000000000000000000 R Constant: (9)00000000000000000000000000001001 Sin Value: (38016083)00000010010001000001010001010011 Logic Function: (2501906144)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (364920519)00010101110000000011111011000111
30
MD5 Generation Iteration 1: Step 23 a = d, d = c, c = b, b = previous resulting value a: (2706708624)10100001010101010001100010010000 b: (364920519)00010101110000000011111011000111 c: (151034077)00001001000000001001100011011101 d: (3706076175)11011100111001100011110000001111 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (3634488961)11011000101000011110011010000001 Logic Function: (2706708624)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (79323828)00000100101110100110001010110100
31
MD5 Generation Iteration 1: Step 24 a = d, d = c, c = b, b = previous resulting value a: (3706076175)11011100111001100011110000001111 b: (79323828)00000100101110100110001010110100 c: (364920519)00010101110000000011111011000111 d: (151034077)00001001000000001001100011011101 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (3889429448)11100111110100111111101111001000 Logic Function: (3706076175)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3952605785)11101011100101111111101001011001
32
MD5 Generation Iteration 1: Step 25 a = d, d = c, c = b, b = previous resulting value a: (151034077)00001001000000001001100011011101 b: (3952605785)11101011100101111111101001011001 c: (79323828)00000100101110100110001010110100 d: (364920519)00010101110000000011111011000111 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (568446438)00100001111000011100110111100110 Logic Function: (151034077)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2134122718)01111111001101000010000011011110
33
MD5 Generation Iteration 1: Step 26 a = d, d = c, c = b, b = previous resulting value a: (364920519)00010101110000000011111011000111 b: (2134122718)01111111001101000010000011011110 c: (3952605785)11101011100101111111101001011001 d: (79323828)00000100101110100110001010110100 Data Block: (32)00000000000000000000000000100000 R Constant: (9)00000000000000000000000000001001 Sin Value: (3275163606)11000011001101110000011111010110 Logic Function: (364920519)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3644020334)11011001001100110101011001101110
34
MD5 Generation Iteration 1: Step 27 a = d, d = c, c = b, b = previous resulting value a: (79323828)00000100101110100110001010110100 b: (3644020334)11011001001100110101011001101110 c: (2134122718)01111111001101000010000011011110 d: (3952605785)11101011100101111111101001011001 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (4107603335)11110100110101010000110110000111 Logic Function: (79323828)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2314587166)10001001111101011100110000011110
35
MD5 Generation Iteration 1: Step 28 a = d, d = c, c = b, b = previous resulting value a: (3952605785)11101011100101111111101001011001 b: (2314587166)10001001111101011100110000011110 c: (3644020334)11011001001100110101011001101110 d: (2134122718)01111111001101000010000011011110 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (1163531501)01000101010110100001010011101101 Logic Function: (3952605785)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3795938996)11100010010000010110111010110100
36
MD5 Generation Iteration 1: Step 29 a = d, d = c, c = b, b = previous resulting value a: (2134122718)01111111001101000010000011011110 b: (3795938996)11100010010000010110111010110100 c: (2314587166)10001001111101011100110000011110 d: (3644020334)11011001001100110101011001101110 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (2850285829)10101001111000111110100100000101 Logic Function: (2134122718)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (503083441)00011101111111000111000110110001
37
MD5 Generation Iteration 1: Step 30 a = d, d = c, c = b, b = previous resulting value a: (3644020334)11011001001100110101011001101110 b: (503083441)00011101111111000111000110110001 c: (3795938996)11100010010000010110111010110100 d: (2314587166)10001001111101011100110000011110 Data Block: (0)00000000000000000000000000000000 R Constant: (9)00000000000000000000000000001001 Sin Value: (4243563512)11111100111011111010001111111000 Logic Function: (3644020334)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1287036469)01001100101101101001111000110101
38
MD5 Generation Iteration 1: Step 31 a = d, d = c, c = b, b = previous resulting value a: (2314587166)10001001111101011100110000011110 b: (1287036469)01001100101101101001111000110101 c: (503083441)00011101111111000111000110110001 d: (3795938996)11100010010000010110111010110100 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (1735328473)01100111011011110000001011011001 Logic Function: (2314587166)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2286006781)10001000010000011011000111111101
39
MD5 Generation Iteration 1: Step 32 a = d, d = c, c = b, b = previous resulting value a: (3795938996)11100010010000010110111010110100 b: (2286006781)10001000010000011011000111111101 c: (1287036469)01001100101101101001111000110101 d: (503083441)00011101111111000111000110110001 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (2368359562)10001101001010100100110010001010 Logic Function: (3795938996)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (930950372)00110111011111010010110011100100
40
MD5 Generation Iteration 1: Step 33 a = d, d = c, c = b, b = previous resulting value a: (503083441)00011101111111000111000110110001 b: (930950372)00110111011111010010110011100100 c: (2286006781)10001000010000011011000111111101 d: (1287036469)01001100101101101001111000110101 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (4294588738)11111111111110100011100101000010 Logic Function: (503083441)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1334316757)01001111100010000000111011010101
41
MD5 Generation Iteration 1: Step 34 a = d, d = c, c = b, b = previous resulting value a: (1287036469)01001100101101101001111000110101 b: (1334316757)01001111100010000000111011010101 c: (930950372)00110111011111010010110011100100 d: (2286006781)10001000010000011011000111111101 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (2272392833)10000111011100011111011010000001 Logic Function: (1287036469)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (952902907)00111000110011000010010011111011
42
MD5 Generation Iteration 1: Step 35 a = d, d = c, c = b, b = previous resulting value a: (2286006781)10001000010000011011000111111101 b: (952902907)00111000110011000010010011111011 c: (1334316757)01001111100010000000111011010101 d: (930950372)00110111011111010010110011100100 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (1839030562)01101101100111010110000100100010 Logic Function: (2286006781)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1387617043)01010010101101010101101100010011
43
MD5 Generation Iteration 1: Step 36 a = d, d = c, c = b, b = previous resulting value a: (930950372)00110111011111010010110011100100 b: (1387617043)01010010101101010101101100010011 c: (952902907)00111000110011000010010011111011 d: (1334316757)01001111100010000000111011010101 Data Block: (32)00000000000000000000000000100000 R Constant: (23)00000000000000000000000000010111 Sin Value: (4259657740)11111101111001010011100000001100 Logic Function: (930950372)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2036532478)01111001011000110000010011111110
44
MD5 Generation Iteration 1: Step 37 a = d, d = c, c = b, b = previous resulting value a: (1334316757)01001111100010000000111011010101 b: (2036532478)01111001011000110000010011111110 c: (1387617043)01010010101101010101101100010011 d: (952902907)00111000110011000010010011111011 Data Block: (128)00000000000000000000000010000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (2763975236)10100100101111101110101001000100 Logic Function: (1334316757)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (4017770478)11101111011110100100111111101110
45
MD5 Generation Iteration 1: Step 38 a = d, d = c, c = b, b = previous resulting value a: (952902907)00111000110011000010010011111011 b: (4017770478)11101111011110100100111111101110 c: (2036532478)01111001011000110000010011111110 d: (1387617043)01010010101101010101101100010011 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (1272893353)01001011110111101100111110101001 Logic Function: (952902907)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2812250680)10100111100111111000101000111000
46
MD5 Generation Iteration 1: Step 39 a = d, d = c, c = b, b = previous resulting value a: (1387617043)01010010101101010101101100010011 b: (2812250680)10100111100111111000101000111000 c: (4017770478)11101111011110100100111111101110 d: (2036532478)01111001011000110000010011111110 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (4139469664)11110110101110110100101101100000 Logic Function: (1387617043)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (255526191)00001111001110110000010100101111
47
MD5 Generation Iteration 1: Step 40 a = d, d = c, c = b, b = previous resulting value a: (2036532478)01111001011000110000010011111110 b: (255526191)00001111001110110000010100101111 c: (2812250680)10100111100111111000101000111000 d: (4017770478)11101111011110100100111111101110 Data Block: (0)00000000000000000000000000000000 R Constant: (23)00000000000000000000000000010111 Sin Value: (3200236656)10111110101111111011110001110000 Logic Function: (2036532478)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1123747312)01000010111110110000010111110000
48
MD5 Generation Iteration 1: Step 41 a = d, d = c, c = b, b = previous resulting value a: (4017770478)11101111011110100100111111101110 b: (1123747312)01000010111110110000010111110000 c: (255526191)00001111001110110000010100101111 d: (2812250680)10100111100111111000101000111000 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (681279174)00101000100110110111111011000110 Logic Function: (4017770478)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1783668640)01101010010100001001111110100000
49
MD5 Generation Iteration 1: Step 42 a = d, d = c, c = b, b = previous resulting value a: (2812250680)10100111100111111000101000111000 b: (1783668640)01101010010100001001111110100000 c: (1123747312)01000010111110110000010111110000 d: (255526191)00001111001110110000010100101111 Data Block: (1953719668)01110100011100110110010101110100 R Constant: (11)00000000000000000000000000001011 Sin Value: (3936430074)11101010101000010010011111111010 Logic Function: (2812250680)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2416560402)10010000000010011100100100010010
50
MD5 Generation Iteration 1: Step 43 a = d, d = c, c = b, b = previous resulting value a: (255526191)00001111001110110000010100101111 b: (2416560402)10010000000010011100100100010010 c: (1783668640)01101010010100001001111110100000 d: (1123747312)01000010111110110000010111110000 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (3572445317)11010100111011110011000010000101 Logic Function: (255526191)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (419456478)00011001000000000110010111011110
51
MD5 Generation Iteration 1: Step 44 a = d, d = c, c = b, b = previous resulting value a: (1123747312)01000010111110110000010111110000 b: (419456478)00011001000000000110010111011110 c: (2416560402)10010000000010011100100100010010 d: (1783668640)01101010010100001001111110100000 Data Block: (0)00000000000000000000000000000000 R Constant: (23)00000000000000000000000000010111 Sin Value: (76029189)00000100100010000001110100000101 Logic Function: (1123747312)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1234555913)01001001100101011101010000001001
52
MD5 Generation Iteration 1: Step 45 a = d, d = c, c = b, b = previous resulting value a: (1783668640)01101010010100001001111110100000 b: (1234555913)01001001100101011101010000001001 c: (419456478)00011001000000000110010111011110 d: (2416560402)10010000000010011100100100010010 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (3654602809)11011001110101001101000000111001 Logic Function: (1783668640)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2511625705)10010101101101000101110111101001
53
MD5 Generation Iteration 1: Step 46 a = d, d = c, c = b, b = previous resulting value a: (2416560402)10010000000010011100100100010010 b: (2511625705)10010101101101000101110111101001 c: (1234555913)01001001100101011101010000001001 d: (419456478)00011001000000000110010111011110 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (3873151461)11100110110110111001100111100101 Logic Function: (2416560402)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3492677577)11010000001011100000011111001001
54
MD5 Generation Iteration 1: Step 47 a = d, d = c, c = b, b = previous resulting value a: (419456478)00011001000000000110010111011110 b: (3492677577)11010000001011100000011111001001 c: (2511625705)10010101101101000101110111101001 d: (1234555913)01001001100101011101010000001001 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (530742520)00011111101000100111110011111000 Logic Function: (419456478)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1093487739)01000001001011010100110001111011
55
MD5 Generation Iteration 1: Step 48 a = d, d = c, c = b, b = previous resulting value a: (1234555913)01001001100101011101010000001001 b: (1093487739)01000001001011010100110001111011 c: (3492677577)11010000001011100000011111001001 d: (2511625705)10010101101101000101110111101001 Data Block: (0)00000000000000000000000000000000 R Constant: (23)00000000000000000000000000010111 Sin Value: (3299628645)11000100101011000101011001100101 Logic Function: (1234555913)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2780219675)10100101101101101100100100011011
56
MD5 Generation Iteration 1: Step 49 a = d, d = c, c = b, b = previous resulting value a: (2511625705)10010101101101000101110111101001 b: (2780219675)10100101101101101100100100011011 c: (1093487739)01000001001011010100110001111011 d: (3492677577)11010000001011100000011111001001 Data Block: (1953719668)01110100011100110110010101110100 R Constant: (6)00000000000000000000000000000110 Sin Value: (4096336452)11110100001010010010001001000100 Logic Function: (2511625705)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (4036854422)11110000100111011000001010010110
57
MD5 Generation Iteration 1: Step 50 a = d, d = c, c = b, b = previous resulting value a: (3492677577)11010000001011100000011111001001 b: (4036854422)11110000100111011000001010010110 c: (2780219675)10100101101101101100100100011011 d: (1093487739)01000001001011010100110001111011 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (1126891415)01000011001010101111111110010111 Logic Function: (3492677577)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (4205131857)11111010101001010011100001010001
58
MD5 Generation Iteration 1: Step 51 a = d, d = c, c = b, b = previous resulting value a: (1093487739)01000001001011010100110001111011 b: (4205131857)11111010101001010011100001010001 c: (4036854422)11110000100111011000001010010110 d: (2780219675)10100101101101101100100100011011 Data Block: (32)00000000000000000000000000100000 R Constant: (15)00000000000000000000000000001111 Sin Value: (2878612391)10101011100101000010001110100111 Logic Function: (1093487739)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (284701674)00010000111110000011001111101010
59
MD5 Generation Iteration 1: Step 52 a = d, d = c, c = b, b = previous resulting value a: (2780219675)10100101101101101100100100011011 b: (284701674)00010000111110000011001111101010 c: (4205131857)11111010101001010011100001010001 d: (4036854422)11110000100111011000001010010110 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (4237533241)11111100100100111010000000111001 Logic Function: (2780219675)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (852044064)00110010110010010010100100100000
60
MD5 Generation Iteration 1: Step 53 a = d, d = c, c = b, b = previous resulting value a: (4036854422)11110000100111011000001010010110 b: (852044064)00110010110010010010100100100000 c: (284701674)00010000111110000011001111101010 d: (4205131857)11111010101001010011100001010001 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (1700485571)01100101010110110101100111000011 Logic Function: (4036854422)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2046251135)01111001111101110101000001111111
61
MD5 Generation Iteration 1: Step 54 a = d, d = c, c = b, b = previous resulting value a: (4205131857)11111010101001010011100001010001 b: (2046251135)01111001111101110101000001111111 c: (852044064)00110010110010010010100100100000 d: (284701674)00010000111110000011001111101010 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (2399980690)10001111000011001100110010010010 Logic Function: (4205131857)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1038113242)00111101111000000101100111011010
62
MD5 Generation Iteration 1: Step 55 a = d, d = c, c = b, b = previous resulting value a: (284701674)00010000111110000011001111101010 b: (1038113242)00111101111000000101100111011010 c: (2046251135)01111001111101110101000001111111 d: (852044064)00110010110010010010100100100000 Data Block: (0)00000000000000000000000000000000 R Constant: (15)00000000000000000000000000001111 Sin Value: (4293915773)11111111111011111111010001111101 Logic Function: (284701674)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (434381902)00011001111001000010010001001110
63
MD5 Generation Iteration 1: Step 56 a = d, d = c, c = b, b = previous resulting value a: (852044064)00110010110010010010100100100000 b: (434381902)00011001111001000010010001001110 c: (1038113242)00111101111000000101100111011010 d: (2046251135)01111001111101110101000001111111 Data Block: (128)00000000000000000000000010000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (2240044497)10000101100001000101110111010001 Logic Function: (852044064)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (3398397853)11001010100011110110111110011101
64
MD5 Generation Iteration 1: Step 57 a = d, d = c, c = b, b = previous resulting value a: (2046251135)01111001111101110101000001111111 b: (3398397853)11001010100011110110111110011101 c: (434381902)00011001111001000010010001001110 d: (1038113242)00111101111000000101100111011010 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (1873313359)01101111101010000111111001001111 Logic Function: (2046251135)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (292954124)00010001011101100010000000001100
65
MD5 Generation Iteration 1: Step 58 a = d, d = c, c = b, b = previous resulting value a: (1038113242)00111101111000000101100111011010 b: (292954124)00010001011101100010000000001100 c: (3398397853)11001010100011110110111110011101 d: (434381902)00011001111001000010010001001110 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (4264355552)11111110001011001110011011100000 Logic Function: (1038113242)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (147425779)00001000110010011000100111110011
66
MD5 Generation Iteration 1: Step 59 a = d, d = c, c = b, b = previous resulting value a: (434381902)00011001111001000010010001001110 b: (147425779)00001000110010011000100111110011 c: (292954124)00010001011101100010000000001100 d: (3398397853)11001010100011110110111110011101 Data Block: (0)00000000000000000000000000000000 R Constant: (15)00000000000000000000000000001111 Sin Value: (2734768916)10100011000000010100001100010100 Logic Function: (434381902)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2574941869)10011001011110100111111010101101
67
MD5 Generation Iteration 1: Step 60 a = d, d = c, c = b, b = previous resulting value a: (3398397853)11001010100011110110111110011101 b: (2574941869)10011001011110100111111010101101 c: (147425779)00001000110010011000100111110011 d: (292954124)00010001011101100010000000001100 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (1309151649)01001110000010000001000110100001 Logic Function: (3398397853)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2193389547)10000010101111000111011111101011
68
MD5 Generation Iteration 1: Step 61 a = d, d = c, c = b, b = previous resulting value a: (292954124)00010001011101100010000000001100 b: (2193389547)10000010101111000111011111101011 c: (2574941869)10011001011110100111111010101101 d: (147425779)00001000110010011000100111110011 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (4149444226)11110111010100110111111010000010 Logic Function: (292954124)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1713794056)01100110001001100110110000001000
69
MD5 Generation Iteration 1: Step 62 a = d, d = c, c = b, b = previous resulting value a: (147425779)00001000110010011000100111110011 b: (1713794056)01100110001001100110110000001000 c: (2193389547)10000010101111000111011111101011 d: (2574941869)10011001011110100111111010101101 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (3174756917)10111101001110101111001000110101 Logic Function: (147425779)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (3867267760)11100110100000011101001010110000
70
MD5 Generation Iteration 1: Step 63 a = d, d = c, c = b, b = previous resulting value a: (2574941869)10011001011110100111111010101101 b: (3867267760)11100110100000011101001010110000 c: (1713794056)01100110001001100110110000001000 d: (2193389547)10000010101111000111011111101011 Data Block: (0)00000000000000000000000000000000 R Constant: (15)00000000000000000000000000001111 Sin Value: (718787259)00101010110101111101001010111011 Logic Function: (2574941869)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (3935568332)11101010100101000000000111001100
71
MD5 Generation Iteration 1: Step 64 a = d, d = c, c = b, b = previous resulting value a: (2193389547)10000010101111000111011111101011 b: (3935568332)11101010100101000000000111001100 c: (3867267760)11100110100000011101001010110000 d: (1713794056)01100110001001100110110000001000 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (3951481745)11101011100001101101001110010001 Logic Function: (2193389547)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2214950333)10000100000001010111010110111101
72
MD5 Generation After Iteration 1: Add the new result to the previous iteration's result h0 + A: 3446378249 h1 + B: 1943216454 h2 + C: 2202984138 h3 + D: 4139001638
73
MD5 Generation After all iterations are complete h0: 3446378249 (Hex: 098f6bcd) h1: 1943216454 (Hex: 4621d373) h2: 2202984138 (Hex: cade4e83) h3: 4139001638 (Hex: 2627b4f6) The final digest: 098f6bcd4621d373cade4e832627b4f6
74
MD5 Generation Summary As you can see, there is quite a bit of bit shifting happening which makes it nearly impossible to reverse engineer The goal of generating hash keys (i.e. Message Digests) is exactly this- to ensure data integrity. Hopefully this presentation has helped you gain a better understanding of how the process of key generation works.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.