Download presentation
Presentation is loading. Please wait.
Published byDesmond Heasley Modified over 9 years ago
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: 'asdasdadadasdasdas' User Input Bytes: 97 115 100 97 115 100 97 100 97 100 97 115 100 97 115 100 97 115
6
MD5 Generation From User Input After Pre-Processing of data, Message Bytes: 97 115 100 97 115 100 97 100 97 100 97 115 100 97 115 100 97 115 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 144 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: (1633973089)01100001011001000111001101100001 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: (1465489317)01010111010110011001011110100101
9
MD5 Generation Iteration 1: Step 2 a = d, d = c, c = b, b = previous resulting value a: (271733878)00010000001100100101010001110110 b: (1465489317)01010111010110011001011110100101 c: (4023233417)11101111110011011010101110001001 d: (2562383102)10011000101110101101110011111110 Data Block: (1684104307)01100100011000010110010001110011 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: (3407559289)11001011000110110011101001111001
10
MD5 Generation Iteration 1: Step 3 a = d, d = c, c = b, b = previous resulting value a: (2562383102)10011000101110101101110011111110 b: (3407559289)11001011000110110011101001111001 c: (1465489317)01010111010110011001011110100101 d: (4023233417)11101111110011011010101110001001 Data Block: (1935762529)01110011011000010110010001100001 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: (1456630445)01010110110100100110101010101101
11
MD5 Generation Iteration 1: Step 4 a = d, d = c, c = b, b = previous resulting value a: (4023233417)11101111110011011010101110001001 b: (1456630445)01010110110100100110101010101101 c: (3407559289)11001011000110110011101001111001 d: (1465489317)01010111010110011001011110100101 Data Block: (1685283172)01100100011100110110000101100100 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: (401125715)00010111111010001011000101010011
12
MD5 Generation Iteration 1: Step 5 a = d, d = c, c = b, b = previous resulting value a: (1465489317)01010111010110011001011110100101 b: (401125715)00010111111010001011000101010011 c: (1456630445)01010110110100100110101010101101 d: (3407559289)11001011000110110011101001111001 Data Block: (8418145)00000000100000000111001101100001 R Constant: (7)00000000000000000000000000000111 Sin Value: (4118548399)11110101011111000000111110101111 Logic Function: (1465489317)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (747315305)00101100100010110010000001101001
13
MD5 Generation Iteration 1: Step 6 a = d, d = c, c = b, b = previous resulting value a: (3407559289)11001011000110110011101001111001 b: (747315305)00101100100010110010000001101001 c: (401125715)00010111111010001011000101010011 d: (1456630445)01010110110100100110101010101101 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (1200080426)01000111100001111100011000101010 Logic Function: (3407559289)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3812730624)11100011010000011010011100000000
14
MD5 Generation Iteration 1: Step 7 a = d, d = c, c = b, b = previous resulting value a: (1456630445)01010110110100100110101010101101 b: (3812730624)11100011010000011010011100000000 c: (747315305)00101100100010110010000001101001 d: (401125715)00010111111010001011000101010011 Data Block: (0)00000000000000000000000000000000 R Constant: (17)00000000000000000000000000010001 Sin Value: (2821735955)10101000001100000100011000010011 Logic Function: (1456630445)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (2775060055)10100101011010000000111001010111
15
MD5 Generation Iteration 1: Step 8 a = d, d = c, c = b, b = previous resulting value a: (401125715)00010111111010001011000101010011 b: (2775060055)10100101011010000000111001010111 c: (3812730624)11100011010000011010011100000000 d: (747315305)00101100100010110010000001101001 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (4249261313)11111101010001101001010100000001 Logic Function: (401125715)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3298282226)11000100100101111100101011110010
16
MD5 Generation Iteration 1: Step 9 a = d, d = c, c = b, b = previous resulting value a: (747315305)00101100100010110010000001101001 b: (3298282226)11000100100101111100101011110010 c: (2775060055)10100101011010000000111001010111 d: (3812730624)11100011010000011010011100000000 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (1770035416)01101001100000001001100011011000 Logic Function: (747315305)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (1787565200)01101010100011000001010010010000
17
MD5 Generation Iteration 1: Step 10 a = d, d = c, c = b, b = previous resulting value a: (3812730624)11100011010000011010011100000000 b: (1787565200)01101010100011000001010010010000 c: (3298282226)11000100100101111100101011110010 d: (2775060055)10100101011010000000111001010111 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (2336552879)10001011010001001111011110101111 Logic Function: (3812730624)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (354711510)00010101001001000111011111010110
18
MD5 Generation Iteration 1: Step 11 a = d, d = c, c = b, b = previous resulting value a: (2775060055)10100101011010000000111001010111 b: (354711510)00010101001001000111011111010110 c: (1787565200)01101010100011000001010010010000 d: (3298282226)11000100100101111100101011110010 Data Block: (0)00000000000000000000000000000000 R Constant: (17)00000000000000000000000000010001 Sin Value: (4294925233)11111111111111110101101110110001 Logic Function: (2775060055)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (580207572)00100010100101010100001111010100
19
MD5 Generation Iteration 1: Step 12 a = d, d = c, c = b, b = previous resulting value a: (3298282226)11000100100101111100101011110010 b: (580207572)00100010100101010100001111010100 c: (354711510)00010101001001000111011111010110 d: (1787565200)01101010100011000001010010010000 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (2304563134)10001001010111001101011110111110 Logic Function: (3298282226)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3283797010)11000011101110101100010000010010
20
MD5 Generation Iteration 1: Step 13 a = d, d = c, c = b, b = previous resulting value a: (1787565200)01101010100011000001010010010000 b: (3283797010)11000011101110101100010000010010 c: (580207572)00100010100101010100001111010100 d: (354711510)00010101001001000111011111010110 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (1804603682)01101011100100000001000100100010 Logic Function: (1787565200)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (470255496)00011100000001111000011110001000
21
MD5 Generation Iteration 1: Step 14 a = d, d = c, c = b, b = previous resulting value a: (354711510)00010101001001000111011111010110 b: (470255496)00011100000001111000011110001000 c: (3283797010)11000011101110101100010000010010 d: (580207572)00100010100101010100001111010100 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (4254626195)11111101100110000111000110010011 Logic Function: (354711510)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (383998684)00010110111000110101101011011100
22
MD5 Generation Iteration 1: Step 15 a = d, d = c, c = b, b = previous resulting value a: (580207572)00100010100101010100001111010100 b: (383998684)00010110111000110101101011011100 c: (470255496)00011100000001111000011110001000 d: (3283797010)11000011101110101100010000010010 Data Block: (144)00000000000000000000000010010000 R Constant: (17)00000000000000000000000000010001 Sin Value: (2792965006)10100110011110010100001110001110 Logic Function: (580207572)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (870094640)00110011110111001001011100110000
23
MD5 Generation Iteration 1: Step 16 a = d, d = c, c = b, b = previous resulting value a: (3283797010)11000011101110101100010000010010 b: (870094640)00110011110111001001011100110000 c: (383998684)00010110111000110101101011011100 d: (470255496)00011100000001111000011110001000 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (1236535329)01001001101101000000100000100001 Logic Function: (3283797010)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3869746087)11100110101001111010001110100111
24
MD5 Generation Iteration 1: Step 17 a = d, d = c, c = b, b = previous resulting value a: (470255496)00011100000001111000011110001000 b: (3869746087)11100110101001111010001110100111 c: (870094640)00110011110111001001011100110000 d: (383998684)00010110111000110101101011011100 Data Block: (1684104307)01100100011000010110010001110011 R Constant: (5)00000000000000000000000000000101 Sin Value: (4129170786)11110110000111100010010101100010 Logic Function: (470255496)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2944058330)10101111011110101100001111011010
25
MD5 Generation Iteration 1: Step 18 a = d, d = c, c = b, b = previous resulting value a: (383998684)00010110111000110101101011011100 b: (2944058330)10101111011110101100001111011010 c: (3869746087)11100110101001111010001110100111 d: (870094640)00110011110111001001011100110000 Data Block: (0)00000000000000000000000000000000 R Constant: (9)00000000000000000000000000001001 Sin Value: (3225465664)11000000010000001011001101000000 Logic Function: (383998684)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (4007537495)11101110110111100010101101010111
26
MD5 Generation Iteration 1: Step 19 a = d, d = c, c = b, b = previous resulting value a: (870094640)00110011110111001001011100110000 b: (4007537495)11101110110111100010101101010111 c: (2944058330)10101111011110101100001111011010 d: (3869746087)11100110101001111010001110100111 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (643717713)00100110010111100101101001010001 Logic Function: (870094640)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1142308317)01000100000101100011110111011101
27
MD5 Generation Iteration 1: Step 20 a = d, d = c, c = b, b = previous resulting value a: (3869746087)11100110101001111010001110100111 b: (1142308317)01000100000101100011110111011101 c: (4007537495)11101110110111100010101101010111 d: (2944058330)10101111011110101100001111011010 Data Block: (1633973089)01100001011001000111001101100001 R Constant: (20)00000000000000000000000000010100 Sin Value: (3921069994)11101001101101101100011110101010 Logic Function: (3869746087)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3440223085)11001101000011011010001101101101
28
MD5 Generation Iteration 1: Step 21 a = d, d = c, c = b, b = previous resulting value a: (2944058330)10101111011110101100001111011010 b: (3440223085)11001101000011011010001101101101 c: (1142308317)01000100000101100011110111011101 d: (4007537495)11101110110111100010101101010111 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (3593408605)11010110001011110001000001011101 Logic Function: (2944058330)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (63906807)00000011110011110010001111110111
29
MD5 Generation Iteration 1: Step 22 a = d, d = c, c = b, b = previous resulting value a: (4007537495)11101110110111100010101101010111 b: (63906807)00000011110011110010001111110111 c: (3440223085)11001101000011011010001101101101 d: (1142308317)01000100000101100011110111011101 Data Block: (0)00000000000000000000000000000000 R Constant: (9)00000000000000000000000000001001 Sin Value: (38016083)00000010010001000001010001010011 Logic Function: (4007537495)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1737908971)01100111100101100110001011101011
30
MD5 Generation Iteration 1: Step 23 a = d, d = c, c = b, b = previous resulting value a: (1142308317)01000100000101100011110111011101 b: (1737908971)01100111100101100110001011101011 c: (63906807)00000011110011110010001111110111 d: (3440223085)11001101000011011010001101101101 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (3634488961)11011000101000011110011010000001 Logic Function: (1142308317)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (4184652810)11111001011011001011110000001010
31
MD5 Generation Iteration 1: Step 24 a = d, d = c, c = b, b = previous resulting value a: (3440223085)11001101000011011010001101101101 b: (4184652810)11111001011011001011110000001010 c: (1737908971)01100111100101100110001011101011 d: (63906807)00000011110011110010001111110111 Data Block: (8418145)00000000100000000111001101100001 R Constant: (20)00000000000000000000000000010100 Sin Value: (3889429448)11100111110100111111101111001000 Logic Function: (3440223085)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (594438129)00100011011011100110011111110001
32
MD5 Generation Iteration 1: Step 25 a = d, d = c, c = b, b = previous resulting value a: (63906807)00000011110011110010001111110111 b: (594438129)00100011011011100110011111110001 c: (4184652810)11111001011011001011110000001010 d: (1737908971)01100111100101100110001011101011 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (568446438)00100001111000011100110111100110 Logic Function: (63906807)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1198292941)01000111011011000111111111001101
33
MD5 Generation Iteration 1: Step 26 a = d, d = c, c = b, b = previous resulting value a: (1737908971)01100111100101100110001011101011 b: (1198292941)01000111011011000111111111001101 c: (594438129)00100011011011100110011111110001 d: (4184652810)11111001011011001011110000001010 Data Block: (144)00000000000000000000000010010000 R Constant: (9)00000000000000000000000000001001 Sin Value: (3275163606)11000011001101110000011111010110 Logic Function: (1737908971)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3208844457)10111111010000110001010010101001
34
MD5 Generation Iteration 1: Step 27 a = d, d = c, c = b, b = previous resulting value a: (4184652810)11111001011011001011110000001010 b: (3208844457)10111111010000110001010010101001 c: (1198292941)01000111011011000111111111001101 d: (594438129)00100011011011100110011111110001 Data Block: (1685283172)01100100011100110110000101100100 R Constant: (14)00000000000000000000000000001110 Sin Value: (4107603335)11110100110101010000110110000111 Logic Function: (4184652810)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2435564326)10010001001010111100001100100110
35
MD5 Generation Iteration 1: Step 28 a = d, d = c, c = b, b = previous resulting value a: (594438129)00100011011011100110011111110001 b: (2435564326)10010001001010111100001100100110 c: (3208844457)10111111010000110001010010101001 d: (1198292941)01000111011011000111111111001101 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (1163531501)01000101010110100001010011101101 Logic Function: (594438129)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2437800546)10010001010011011110001001100010
36
MD5 Generation Iteration 1: Step 29 a = d, d = c, c = b, b = previous resulting value a: (1198292941)01000111011011000111111111001101 b: (2437800546)10010001010011011110001001100010 c: (2435564326)10010001001010111100001100100110 d: (3208844457)10111111010000110001010010101001 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (2850285829)10101001111000111110100100000101 Logic Function: (1198292941)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3901972850)11101000100100110110000101110010
37
MD5 Generation Iteration 1: Step 30 a = d, d = c, c = b, b = previous resulting value a: (3208844457)10111111010000110001010010101001 b: (3901972850)11101000100100110110000101110010 c: (2437800546)10010001010011011110001001100010 d: (2435564326)10010001001010111100001100100110 Data Block: (1935762529)01110011011000010110010001100001 R Constant: (9)00000000000000000000000000001001 Sin Value: (4243563512)11111100111011111010001111111000 Logic Function: (3208844457)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2677025489)10011111100100000010101011010001
38
MD5 Generation Iteration 1: Step 31 a = d, d = c, c = b, b = previous resulting value a: (2435564326)10010001001010111100001100100110 b: (2677025489)10011111100100000010101011010001 c: (3901972850)11101000100100110110000101110010 d: (2437800546)10010001010011011110001001100010 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (1735328473)01100111011011110000001011011001 Logic Function: (2435564326)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3655608156)11011001111001000010011101011100
39
MD5 Generation Iteration 1: Step 32 a = d, d = c, c = b, b = previous resulting value a: (2437800546)10010001010011011110001001100010 b: (3655608156)11011001111001000010011101011100 c: (2677025489)10011111100100000010101011010001 d: (3901972850)11101000100100110110000101110010 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (2368359562)10001101001010100100110010001010 Logic Function: (2437800546)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2244216545)10000101110001000000011011100001
40
MD5 Generation Iteration 1: Step 33 a = d, d = c, c = b, b = previous resulting value a: (3901972850)11101000100100110110000101110010 b: (2244216545)10000101110001000000011011100001 c: (3655608156)11011001111001000010011101011100 d: (2677025489)10011111100100000010101011010001 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (4294588738)11111111111110100011100101000010 Logic Function: (3901972850)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1235118315)01001001100111100110100011101011
41
MD5 Generation Iteration 1: Step 34 a = d, d = c, c = b, b = previous resulting value a: (2677025489)10011111100100000010101011010001 b: (1235118315)01001001100111100110100011101011 c: (2244216545)10000101110001000000011011100001 d: (3655608156)11011001111001000010011101011100 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (2272392833)10000111011100011111011010000001 Logic Function: (2677025489)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1291037393)01001100111100111010101011010001
42
MD5 Generation Iteration 1: Step 35 a = d, d = c, c = b, b = previous resulting value a: (3655608156)11011001111001000010011101011100 b: (1291037393)01001100111100111010101011010001 c: (1235118315)01001001100111100110100011101011 d: (2244216545)10000101110001000000011011100001 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (1839030562)01101101100111010110000100100010 Logic Function: (3655608156)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2588766972)10011010010011010111001011111100
43
MD5 Generation Iteration 1: Step 36 a = d, d = c, c = b, b = previous resulting value a: (2244216545)10000101110001000000011011100001 b: (2588766972)10011010010011010111001011111100 c: (1291037393)01001100111100111010101011010001 d: (1235118315)01001001100111100110100011101011 Data Block: (144)00000000000000000000000010010000 R Constant: (23)00000000000000000000000000010111 Sin Value: (4259657740)11111101111001010011100000001100 Logic Function: (2244216545)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3151943668)10111011110111101101011111110100
44
MD5 Generation Iteration 1: Step 37 a = d, d = c, c = b, b = previous resulting value a: (1235118315)01001001100111100110100011101011 b: (3151943668)10111011110111101101011111110100 c: (2588766972)10011010010011010111001011111100 d: (1291037393)01001100111100111010101011010001 Data Block: (1684104307)01100100011000010110010001110011 R Constant: (4)00000000000000000000000000000100 Sin Value: (2763975236)10100100101111101110101001000100 Logic Function: (1235118315)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3184218032)10111101110010110100111110110000
45
MD5 Generation Iteration 1: Step 38 a = d, d = c, c = b, b = previous resulting value a: (1291037393)01001100111100111010101011010001 b: (3184218032)10111101110010110100111110110000 c: (3151943668)10111011110111101101011111110100 d: (2588766972)10011010010011010111001011111100 Data Block: (8418145)00000000100000000111001101100001 R Constant: (11)00000000000000000000000000001011 Sin Value: (1272893353)01001011110111101100111110101001 Logic Function: (1291037393)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (479193437)00011100100011111110100101011101
46
MD5 Generation Iteration 1: Step 39 a = d, d = c, c = b, b = previous resulting value a: (2588766972)10011010010011010111001011111100 b: (479193437)00011100100011111110100101011101 c: (3184218032)10111101110010110100111110110000 d: (3151943668)10111011110111101101011111110100 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (4139469664)11110110101110110100101101100000 Logic Function: (2588766972)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1275434240)01001100000001011001010100000000
47
MD5 Generation Iteration 1: Step 40 a = d, d = c, c = b, b = previous resulting value a: (3151943668)10111011110111101101011111110100 b: (1275434240)01001100000001011001010100000000 c: (479193437)00011100100011111110100101011101 d: (3184218032)10111101110010110100111110110000 Data Block: (0)00000000000000000000000000000000 R Constant: (23)00000000000000000000000000010111 Sin Value: (3200236656)10111110101111111011110001110000 Logic Function: (3151943668)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1958315236)01110100101110011000010011100100
48
MD5 Generation Iteration 1: Step 41 a = d, d = c, c = b, b = previous resulting value a: (3184218032)10111101110010110100111110110000 b: (1958315236)01110100101110011000010011100100 c: (1275434240)01001100000001011001010100000000 d: (479193437)00011100100011111110100101011101 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (681279174)00101000100110110111111011000110 Logic Function: (3184218032)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (509999060)00011110011001011111011111010100
49
MD5 Generation Iteration 1: Step 42 a = d, d = c, c = b, b = previous resulting value a: (479193437)00011100100011111110100101011101 b: (509999060)00011110011001011111011111010100 c: (1958315236)01110100101110011000010011100100 d: (1275434240)01001100000001011001010100000000 Data Block: (1633973089)01100001011001000111001101100001 R Constant: (11)00000000000000000000000000001011 Sin Value: (3936430074)11101010101000010010011111111010 Logic Function: (479193437)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2579315791)10011001101111010011110001001111
50
MD5 Generation Iteration 1: Step 43 a = d, d = c, c = b, b = previous resulting value a: (1275434240)01001100000001011001010100000000 b: (2579315791)10011001101111010011110001001111 c: (509999060)00011110011001011111011111010100 d: (1958315236)01110100101110011000010011100100 Data Block: (1685283172)01100100011100110110000101100100 R Constant: (16)00000000000000000000000000010000 Sin Value: (3572445317)11010100111011110011000010000101 Logic Function: (1275434240)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (270906648)00010000001001011011010100011000
51
MD5 Generation Iteration 1: Step 44 a = d, d = c, c = b, b = previous resulting value a: (1958315236)01110100101110011000010011100100 b: (270906648)00010000001001011011010100011000 c: (2579315791)10011001101111010011110001001111 d: (509999060)00011110011001011111011111010100 Data Block: (0)00000000000000000000000000000000 R Constant: (23)00000000000000000000000000010111 Sin Value: (76029189)00000100100010000001110100000101 Logic Function: (1958315236)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1177441448)01000110001011100101010010101000
52
MD5 Generation Iteration 1: Step 45 a = d, d = c, c = b, b = previous resulting value a: (509999060)00011110011001011111011111010100 b: (1177441448)01000110001011100101010010101000 c: (270906648)00010000001001011011010100011000 d: (2579315791)10011001101111010011110001001111 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (3654602809)11011001110101001101000000111001 Logic Function: (509999060)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3309876596)11000101010010001011010101110100
53
MD5 Generation Iteration 1: Step 46 a = d, d = c, c = b, b = previous resulting value a: (2579315791)10011001101111010011110001001111 b: (3309876596)11000101010010001011010101110100 c: (1177441448)01000110001011100101010010101000 d: (270906648)00010000001001011011010100011000 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (3873151461)11100110110110111001100111100101 Logic Function: (2579315791)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2795533842)10100110101000000111011000010010
54
MD5 Generation Iteration 1: Step 47 a = d, d = c, c = b, b = previous resulting value a: (270906648)00010000001001011011010100011000 b: (2795533842)10100110101000000111011000010010 c: (3309876596)11000101010010001011010101110100 d: (1177441448)01000110001011100101010010101000 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (530742520)00011111101000100111110011111000 Logic Function: (270906648)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1887357856)01110000011111101100101110100000
55
MD5 Generation Iteration 1: Step 48 a = d, d = c, c = b, b = previous resulting value a: (1177441448)01000110001011100101010010101000 b: (1887357856)01110000011111101100101110100000 c: (2795533842)10100110101000000111011000010010 d: (3309876596)11000101010010001011010101110100 Data Block: (1935762529)01110011011000010110010001100001 R Constant: (23)00000000000000000000000000010111 Sin Value: (3299628645)11000100101011000101011001100101 Logic Function: (1177441448)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2328343724)10001010110001111011010010101100
56
MD5 Generation Iteration 1: Step 49 a = d, d = c, c = b, b = previous resulting value a: (3309876596)11000101010010001011010101110100 b: (2328343724)10001010110001111011010010101100 c: (1887357856)01110000011111101100101110100000 d: (2795533842)10100110101000000111011000010010 Data Block: (1633973089)01100001011001000111001101100001 R Constant: (6)00000000000000000000000000000110 Sin Value: (4096336452)11110100001010010010001001000100 Logic Function: (3309876596)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (683150941)00101000101110000000111001011101
57
MD5 Generation Iteration 1: Step 50 a = d, d = c, c = b, b = previous resulting value a: (2795533842)10100110101000000111011000010010 b: (683150941)00101000101110000000111001011101 c: (2328343724)10001010110001111011010010101100 d: (1887357856)01110000011111101100101110100000 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (1126891415)01000011001010101111111110010111 Logic Function: (2795533842)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1354399386)01010000101110100111111010011010
58
MD5 Generation Iteration 1: Step 51 a = d, d = c, c = b, b = previous resulting value a: (1887357856)01110000011111101100101110100000 b: (1354399386)01010000101110100111111010011010 c: (683150941)00101000101110000000111001011101 d: (2328343724)10001010110001111011010010101100 Data Block: (144)00000000000000000000000010010000 R Constant: (15)00000000000000000000000000001111 Sin Value: (2878612391)10101011100101000010001110100111 Logic Function: (1887357856)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (23673636)00000001011010010011101100100100
59
MD5 Generation Iteration 1: Step 52 a = d, d = c, c = b, b = previous resulting value a: (2328343724)10001010110001111011010010101100 b: (23673636)00000001011010010011101100100100 c: (1354399386)01010000101110100111111010011010 d: (683150941)00101000101110000000111001011101 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (4237533241)11111100100100111010000000111001 Logic Function: (2328343724)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1166745919)01000101100010110010000100111111
60
MD5 Generation Iteration 1: Step 53 a = d, d = c, c = b, b = previous resulting value a: (683150941)00101000101110000000111001011101 b: (1166745919)01000101100010110010000100111111 c: (23673636)00000001011010010011101100100100 d: (1354399386)01010000101110100111111010011010 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (1700485571)01100101010110110101100111000011 Logic Function: (683150941)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1946927134)01110100000010111100000000011110
61
MD5 Generation Iteration 1: Step 54 a = d, d = c, c = b, b = previous resulting value a: (1354399386)01010000101110100111111010011010 b: (1946927134)01110100000010111100000000011110 c: (1166745919)01000101100010110010000100111111 d: (23673636)00000001011010010011101100100100 Data Block: (1685283172)01100100011100110110000101100100 R Constant: (10)00000000000000000000000000001010 Sin Value: (2399980690)10001111000011001100110010010010 Logic Function: (1354399386)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2991948827)10110010010101011000010000011011
62
MD5 Generation Iteration 1: Step 55 a = d, d = c, c = b, b = previous resulting value a: (23673636)00000001011010010011101100100100 b: (2991948827)10110010010101011000010000011011 c: (1946927134)01110100000010111100000000011110 d: (1166745919)01000101100010110010000100111111 Data Block: (0)00000000000000000000000000000000 R Constant: (15)00000000000000000000000000001111 Sin Value: (4293915773)11111111111011111111010001111101 Logic Function: (23673636)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1502145542)01011001100010001110110000000110
63
MD5 Generation Iteration 1: Step 56 a = d, d = c, c = b, b = previous resulting value a: (1166745919)01000101100010110010000100111111 b: (1502145542)01011001100010001110110000000110 c: (2991948827)10110010010101011000010000011011 d: (1946927134)01110100000010111100000000011110 Data Block: (1684104307)01100100011000010110010001110011 R Constant: (21)00000000000000000000000000010101 Sin Value: (2240044497)10000101100001000101110111010001 Logic Function: (1166745919)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1232867153)01001001011111000000111101010001
64
MD5 Generation Iteration 1: Step 57 a = d, d = c, c = b, b = previous resulting value a: (1946927134)01110100000010111100000000011110 b: (1232867153)01001001011111000000111101010001 c: (1502145542)01011001100010001110110000000110 d: (2991948827)10110010010101011000010000011011 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (1873313359)01101111101010000111111001001111 Logic Function: (1946927134)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1412474767)01010100001100001010011110001111
65
MD5 Generation Iteration 1: Step 58 a = d, d = c, c = b, b = previous resulting value a: (2991948827)10110010010101011000010000011011 b: (1412474767)01010100001100001010011110001111 c: (1232867153)01001001011111000000111101010001 d: (1502145542)01011001100010001110110000000110 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (4264355552)11111110001011001110011011100000 Logic Function: (2991948827)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2361347405)10001100101111110100110101001101
66
MD5 Generation Iteration 1: Step 59 a = d, d = c, c = b, b = previous resulting value a: (1502145542)01011001100010001110110000000110 b: (2361347405)10001100101111110100110101001101 c: (1412474767)01010100001100001010011110001111 d: (1232867153)01001001011111000000111101010001 Data Block: (0)00000000000000000000000000000000 R Constant: (15)00000000000000000000000000001111 Sin Value: (2734768916)10100011000000010100001100010100 Logic Function: (1502145542)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1367130329)01010001011111001100000011011001
67
MD5 Generation Iteration 1: Step 60 a = d, d = c, c = b, b = previous resulting value a: (1232867153)01001001011111000000111101010001 b: (1367130329)01010001011111001100000011011001 c: (2361347405)10001100101111110100110101001101 d: (1412474767)01010100001100001010011110001111 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (1309151649)01001110000010000001000110100001 Logic Function: (1232867153)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (641636719)00100110001111101001100101101111
68
MD5 Generation Iteration 1: Step 61 a = d, d = c, c = b, b = previous resulting value a: (1412474767)01010100001100001010011110001111 b: (641636719)00100110001111101001100101101111 c: (1367130329)01010001011111001100000011011001 d: (2361347405)10001100101111110100110101001101 Data Block: (8418145)00000000100000000111001101100001 R Constant: (6)00000000000000000000000000000110 Sin Value: (4149444226)11110111010100110111111010000010 Logic Function: (1412474767)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2818817931)10101000000000111011111110001011
69
MD5 Generation Iteration 1: Step 62 a = d, d = c, c = b, b = previous resulting value a: (2361347405)10001100101111110100110101001101 b: (2818817931)10101000000000111011111110001011 c: (641636719)00100110001111101001100101101111 d: (1367130329)01010001011111001100000011011001 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (3174756917)10111101001110101111001000110101 Logic Function: (2361347405)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2241645269)10000101100111001100101011010101
70
MD5 Generation Iteration 1: Step 63 a = d, d = c, c = b, b = previous resulting value a: (1367130329)01010001011111001100000011011001 b: (2241645269)10000101100111001100101011010101 c: (2818817931)10101000000000111011111110001011 d: (641636719)00100110001111101001100101101111 Data Block: (1935762529)01110011011000010110010001100001 R Constant: (15)00000000000000000000000000001111 Sin Value: (718787259)00101010110101111101001010111011 Logic Function: (1367130329)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2856746399)10101010010001100111110110011111
71
MD5 Generation Iteration 1: Step 64 a = d, d = c, c = b, b = previous resulting value a: (641636719)00100110001111101001100101101111 b: (2856746399)10101010010001100111110110011111 c: (2241645269)10000101100111001100101011010101 d: (2818817931)10101000000000111011111110001011 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (3951481745)11101011100001101101001110010001 Logic Function: (641636719)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (798491299)00101111100110000000001010100011
72
MD5 Generation After Iteration 1: Add the new result to the previous iteration's result h0 + A: 256434828 h1 + B: 526757420 h2 + C: 1124162205 h3 + D: 2513379147
73
MD5 Generation After all iterations are complete h0: 256434828 (Hex: 8ce2480f) h1: 526757420 (Hex: 2cae651f) h2: 1124162205 (Hex: 9d5a0143) h3: 2513379147 (Hex: 4b1fcf95) The final digest: 8ce2480f2cae651f9d5a01434b1fcf95
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.