Presentation is loading. Please wait.

Presentation is loading. Please wait.

MD5 Generation Auto-Generated Slides To Visualize MD5 Hash Generation by Chris Fremgen.

Similar presentations


Presentation on theme: "MD5 Generation Auto-Generated Slides To Visualize MD5 Hash Generation by Chris Fremgen."— Presentation transcript:

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: 'sfgsdfgdfgd' User Input Bytes: 115 102 103 115 100 102 103 100 102 103 100

6 MD5 Generation From User Input After Pre-Processing of data, Message Bytes: 115 102 103 115 100 102 103 100 102 103 100 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 88 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: (1936156275)01110011011001110110011001110011 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: (1490231470)01011000110100110010000010101110

9 MD5 Generation Iteration 1: Step 2 a = d, d = c, c = b, b = previous resulting value a: (271733878)00010000001100100101010001110110 b: (1490231470)01011000110100110010000010101110 c: (4023233417)11101111110011011010101110001001 d: (2562383102)10011000101110101101110011111110 Data Block: (1684498020)01100100011001110110011001100100 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: (264479506)00001111110000111010001100010010

10 MD5 Generation Iteration 1: Step 3 a = d, d = c, c = b, b = previous resulting value a: (2562383102)10011000101110101101110011111110 b: (264479506)00001111110000111010001100010010 c: (1490231470)01011000110100110010000010101110 d: (4023233417)11101111110011011010101110001001 Data Block: (2154063718)10000000011001000110011101100110 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: (3411537711)11001011010101111110111100101111

11 MD5 Generation Iteration 1: Step 4 a = d, d = c, c = b, b = previous resulting value a: (4023233417)11101111110011011010101110001001 b: (3411537711)11001011010101111110111100101111 c: (264479506)00001111110000111010001100010010 d: (1490231470)01011000110100110010000010101110 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: (1238057718)01001001110010110100001011110110

12 MD5 Generation Iteration 1: Step 5 a = d, d = c, c = b, b = previous resulting value a: (1490231470)01011000110100110010000010101110 b: (1238057718)01001001110010110100001011110110 c: (3411537711)11001011010101111110111100101111 d: (264479506)00001111110000111010001100010010 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (4118548399)11110101011111000000111110101111 Logic Function: (1490231470)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (324338884)00010011010101010000010011000100

13 MD5 Generation Iteration 1: Step 6 a = d, d = c, c = b, b = previous resulting value a: (264479506)00001111110000111010001100010010 b: (324338884)00010011010101010000010011000100 c: (1238057718)01001001110010110100001011110110 d: (3411537711)11001011010101111110111100101111 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (1200080426)01000111100001111100011000101010 Logic Function: (264479506)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (145209036)00001000101001111011011011001100

14 MD5 Generation Iteration 1: Step 7 a = d, d = c, c = b, b = previous resulting value a: (3411537711)11001011010101111110111100101111 b: (145209036)00001000101001111011011011001100 c: (324338884)00010011010101010000010011000100 d: (1238057718)01001001110010110100001011110110 Data Block: (0)00000000000000000000000000000000 R Constant: (17)00000000000000000000000000010001 Sin Value: (2821735955)10101000001100000100011000010011 Logic Function: (3411537711)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (4246282358)11111101000110010010000001110110

15 MD5 Generation Iteration 1: Step 8 a = d, d = c, c = b, b = previous resulting value a: (1238057718)01001001110010110100001011110110 b: (4246282358)11111101000110010010000001110110 c: (145209036)00001000101001111011011011001100 d: (324338884)00010011010101010000010011000100 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (4249261313)11111101010001101001010100000001 Logic Function: (1238057718)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (736982581)00101011111011010111011000110101

16 MD5 Generation Iteration 1: Step 9 a = d, d = c, c = b, b = previous resulting value a: (324338884)00010011010101010000010011000100 b: (736982581)00101011111011010111011000110101 c: (4246282358)11111101000110010010000001110110 d: (145209036)00001000101001111011011011001100 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (1770035416)01101001100000001001100011011000 Logic Function: (324338884)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (478986887)00011100100011001100001010000111

17 MD5 Generation Iteration 1: Step 10 a = d, d = c, c = b, b = previous resulting value a: (145209036)00001000101001111011011011001100 b: (478986887)00011100100011001100001010000111 c: (736982581)00101011111011010111011000110101 d: (4246282358)11111101000110010010000001110110 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (2336552879)10001011010001001111011110101111 Logic Function: (145209036)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3181103711)10111101100110111100101001011111

18 MD5 Generation Iteration 1: Step 11 a = d, d = c, c = b, b = previous resulting value a: (4246282358)11111101000110010010000001110110 b: (3181103711)10111101100110111100101001011111 c: (478986887)00011100100011001100001010000111 d: (736982581)00101011111011010111011000110101 Data Block: (0)00000000000000000000000000000000 R Constant: (17)00000000000000000000000000010001 Sin Value: (4294925233)11111111111111110101101110110001 Logic Function: (4246282358)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (2721579625)10100010001110000000001001101001

19 MD5 Generation Iteration 1: Step 12 a = d, d = c, c = b, b = previous resulting value a: (736982581)00101011111011010111011000110101 b: (2721579625)10100010001110000000001001101001 c: (3181103711)10111101100110111100101001011111 d: (478986887)00011100100011001100001010000111 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (2304563134)10001001010111001101011110111110 Logic Function: (736982581)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3537140781)11010010110101000111110000101101

20 MD5 Generation Iteration 1: Step 13 a = d, d = c, c = b, b = previous resulting value a: (478986887)00011100100011001100001010000111 b: (3537140781)11010010110101000111110000101101 c: (2721579625)10100010001110000000001001101001 d: (3181103711)10111101100110111100101001011111 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (1804603682)01101011100100000001000100100010 Logic Function: (478986887)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (1862241864)01101110111111111000111001001000

21 MD5 Generation Iteration 1: Step 14 a = d, d = c, c = b, b = previous resulting value a: (3181103711)10111101100110111100101001011111 b: (1862241864)01101110111111111000111001001000 c: (3537140781)11010010110101000111110000101101 d: (2721579625)10100010001110000000001001101001 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (4254626195)11111101100110000111000110010011 Logic Function: (3181103711)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (4085335592)11110011100000010100011000101000

22 MD5 Generation Iteration 1: Step 15 a = d, d = c, c = b, b = previous resulting value a: (2721579625)10100010001110000000001001101001 b: (4085335592)11110011100000010100011000101000 c: (1862241864)01101110111111111000111001001000 d: (3537140781)11010010110101000111110000101101 Data Block: (88)00000000000000000000000001011000 R Constant: (17)00000000000000000000000000010001 Sin Value: (2792965006)10100110011110010100001110001110 Logic Function: (2721579625)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (4231699765)11111100001110101001110100110101

23 MD5 Generation Iteration 1: Step 16 a = d, d = c, c = b, b = previous resulting value a: (3537140781)11010010110101000111110000101101 b: (4231699765)11111100001110101001110100110101 c: (4085335592)11110011100000010100011000101000 d: (1862241864)01101110111111111000111001001000 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (1236535329)01001001101101000000100000100001 Logic Function: (3537140781)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (2847830167)10101001101111100111000010010111

24 MD5 Generation Iteration 1: Step 17 a = d, d = c, c = b, b = previous resulting value a: (1862241864)01101110111111111000111001001000 b: (2847830167)10101001101111100111000010010111 c: (4231699765)11111100001110101001110100110101 d: (4085335592)11110011100000010100011000101000 Data Block: (1684498020)01100100011001110110011001100100 R Constant: (5)00000000000000000000000000000101 Sin Value: (4129170786)11110110000111100010010101100010 Logic Function: (1862241864)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2445071621)10010001101111001101010100000101

25 MD5 Generation Iteration 1: Step 18 a = d, d = c, c = b, b = previous resulting value a: (4085335592)11110011100000010100011000101000 b: (2445071621)10010001101111001101010100000101 c: (2847830167)10101001101111100111000010010111 d: (4231699765)11111100001110101001110100110101 Data Block: (0)00000000000000000000000000000000 R Constant: (9)00000000000000000000000000001001 Sin Value: (3225465664)11000000010000001011001101000000 Logic Function: (4085335592)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2409280399)10001111100110101011001110001111

26 MD5 Generation Iteration 1: Step 19 a = d, d = c, c = b, b = previous resulting value a: (4231699765)11111100001110101001110100110101 b: (2409280399)10001111100110101011001110001111 c: (2445071621)10010001101111001101010100000101 d: (2847830167)10101001101111100111000010010111 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (643717713)00100110010111100101101001010001 Logic Function: (4231699765)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2061378203)01111010110111100010001010011011

27 MD5 Generation Iteration 1: Step 20 a = d, d = c, c = b, b = previous resulting value a: (2847830167)10101001101111100111000010010111 b: (2061378203)01111010110111100010001010011011 c: (2409280399)10001111100110101011001110001111 d: (2445071621)10010001101111001101010100000101 Data Block: (1936156275)01110011011001110110011001110011 R Constant: (20)00000000000000000000000000010100 Sin Value: (3921069994)11101001101101101100011110101010 Logic Function: (2847830167)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2396027463)10001110110100000111101001000111

28 MD5 Generation Iteration 1: Step 21 a = d, d = c, c = b, b = previous resulting value a: (2445071621)10010001101111001101010100000101 b: (2396027463)10001110110100000111101001000111 c: (2061378203)01111010110111100010001010011011 d: (2409280399)10001111100110101011001110001111 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (3593408605)11010110001011110001000001011101 Logic Function: (2445071621)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1725131123)01100110110100110110100101110011

29 MD5 Generation Iteration 1: Step 22 a = d, d = c, c = b, b = previous resulting value a: (2409280399)10001111100110101011001110001111 b: (1725131123)01100110110100110110100101110011 c: (2396027463)10001110110100000111101001000111 d: (2061378203)01111010110111100010001010011011 Data Block: (0)00000000000000000000000000000000 R Constant: (9)00000000000000000000000000001001 Sin Value: (38016083)00000010010001000001010001010011 Logic Function: (2409280399)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3377716324)11001001010100111101110001100100

30 MD5 Generation Iteration 1: Step 23 a = d, d = c, c = b, b = previous resulting value a: (2061378203)01111010110111100010001010011011 b: (3377716324)11001001010100111101110001100100 c: (1725131123)01100110110100110110100101110011 d: (2396027463)10001110110100000111101001000111 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (3634488961)11011000101000011110011010000001 Logic Function: (2061378203)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2717379416)10100001111101111110101101011000

31 MD5 Generation Iteration 1: Step 24 a = d, d = c, c = b, b = previous resulting value a: (2396027463)10001110110100000111101001000111 b: (2717379416)10100001111101111110101101011000 c: (3377716324)11001001010100111101110001100100 d: (1725131123)01100110110100110110100101110011 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (3889429448)11100111110100111111101111001000 Logic Function: (2396027463)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3626627807)11011000001010011111001011011111

32 MD5 Generation Iteration 1: Step 25 a = d, d = c, c = b, b = previous resulting value a: (1725131123)01100110110100110110100101110011 b: (3626627807)11011000001010011111001011011111 c: (2717379416)10100001111101111110101101011000 d: (3377716324)11001001010100111101110001100100 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (568446438)00100001111000011100110111100110 Logic Function: (1725131123)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (59722125)00000011100011110100100110001101

33 MD5 Generation Iteration 1: Step 26 a = d, d = c, c = b, b = previous resulting value a: (3377716324)11001001010100111101110001100100 b: (59722125)00000011100011110100100110001101 c: (3626627807)11011000001010011111001011011111 d: (2717379416)10100001111101111110101101011000 Data Block: (88)00000000000000000000000001011000 R Constant: (9)00000000000000000000000000001001 Sin Value: (3275163606)11000011001101110000011111010110 Logic Function: (3377716324)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (940281177)00111000000010111000110101011001

34 MD5 Generation Iteration 1: Step 27 a = d, d = c, c = b, b = previous resulting value a: (2717379416)10100001111101111110101101011000 b: (940281177)00111000000010111000110101011001 c: (59722125)00000011100011110100100110001101 d: (3626627807)11011000001010011111001011011111 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (4107603335)11110100110101010000110110000111 Logic Function: (2717379416)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1486469616)01011000100110011011100111110000

35 MD5 Generation Iteration 1: Step 28 a = d, d = c, c = b, b = previous resulting value a: (3626627807)11011000001010011111001011011111 b: (1486469616)01011000100110011011100111110000 c: (940281177)00111000000010111000110101011001 d: (59722125)00000011100011110100100110001101 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (1163531501)01000101010110100001010011101101 Logic Function: (3626627807)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2992577225)10110010010111110001101011001001

36 MD5 Generation Iteration 1: Step 29 a = d, d = c, c = b, b = previous resulting value a: (59722125)00000011100011110100100110001101 b: (2992577225)10110010010111110001101011001001 c: (1486469616)01011000100110011011100111110000 d: (940281177)00111000000010111000110101011001 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (2850285829)10101001111000111110100100000101 Logic Function: (59722125)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1949076012)01110100001011001000101000101100

37 MD5 Generation Iteration 1: Step 30 a = d, d = c, c = b, b = previous resulting value a: (940281177)00111000000010111000110101011001 b: (1949076012)01110100001011001000101000101100 c: (2992577225)10110010010111110001101011001001 d: (1486469616)01011000100110011011100111110000 Data Block: (2154063718)10000000011001000110011101100110 R Constant: (9)00000000000000000000000000001001 Sin Value: (4243563512)11111100111011111010001111111000 Logic Function: (940281177)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3497151355)11010000011100100100101101111011

38 MD5 Generation Iteration 1: Step 31 a = d, d = c, c = b, b = previous resulting value a: (1486469616)01011000100110011011100111110000 b: (3497151355)11010000011100100100101101111011 c: (1949076012)01110100001011001000101000101100 d: (2992577225)10110010010111110001101011001001 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (1735328473)01100111011011110000001011011001 Logic Function: (1486469616)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2722099353)10100010001111111111000010011001

39 MD5 Generation Iteration 1: Step 32 a = d, d = c, c = b, b = previous resulting value a: (2992577225)10110010010111110001101011001001 b: (2722099353)10100010001111111111000010011001 c: (3497151355)11010000011100100100101101111011 d: (1949076012)01110100001011001000101000101100 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (2368359562)10001101001010100100110010001010 Logic Function: (2992577225)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (757985563)00101101001011011111000100011011

40 MD5 Generation Iteration 1: Step 33 a = d, d = c, c = b, b = previous resulting value a: (1949076012)01110100001011001000101000101100 b: (757985563)00101101001011011111000100011011 c: (2722099353)10100010001111111111000010011001 d: (3497151355)11010000011100100100101101111011 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (4294588738)11111111111110100011100101000010 Logic Function: (1949076012)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1704908696)01100101100111101101011110011000

41 MD5 Generation Iteration 1: Step 34 a = d, d = c, c = b, b = previous resulting value a: (3497151355)11010000011100100100101101111011 b: (1704908696)01100101100111101101011110011000 c: (757985563)00101101001011011111000100011011 d: (2722099353)10100010001111111111000010011001 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (2272392833)10000111011100011111011010000001 Logic Function: (3497151355)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3999238571)11101110010111111000100110101011

42 MD5 Generation Iteration 1: Step 35 a = d, d = c, c = b, b = previous resulting value a: (2722099353)10100010001111111111000010011001 b: (3999238571)11101110010111111000100110101011 c: (1704908696)01100101100111101101011110011000 d: (757985563)00101101001011011111000100011011 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (1839030562)01101101100111010110000100100010 Logic Function: (2722099353)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (4014162037)11101111010000110100000001110101

43 MD5 Generation Iteration 1: Step 36 a = d, d = c, c = b, b = previous resulting value a: (757985563)00101101001011011111000100011011 b: (4014162037)11101111010000110100000001110101 c: (3999238571)11101110010111111000100110101011 d: (1704908696)01100101100111101101011110011000 Data Block: (88)00000000000000000000000001011000 R Constant: (23)00000000000000000000000000010111 Sin Value: (4259657740)11111101111001010011100000001100 Logic Function: (757985563)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3523939096)11010010000010110000101100011000

44 MD5 Generation Iteration 1: Step 37 a = d, d = c, c = b, b = previous resulting value a: (1704908696)01100101100111101101011110011000 b: (3523939096)11010010000010110000101100011000 c: (4014162037)11101111010000110100000001110101 d: (3999238571)11101110010111111000100110101011 Data Block: (1684498020)01100100011001110110011001100100 R Constant: (4)00000000000000000000000000000100 Sin Value: (2763975236)10100100101111101110101001000100 Logic Function: (1704908696)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (4024023932)11101111110110011011101101111100

45 MD5 Generation Iteration 1: Step 38 a = d, d = c, c = b, b = previous resulting value a: (3999238571)11101110010111111000100110101011 b: (4024023932)11101111110110011011101101111100 c: (3523939096)11010010000010110000101100011000 d: (4014162037)11101111010000110100000001110101 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (1272893353)01001011110111101100111110101001 Logic Function: (3999238571)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1915020258)01110010001001001110001111100010

46 MD5 Generation Iteration 1: Step 39 a = d, d = c, c = b, b = previous resulting value a: (4014162037)11101111010000110100000001110101 b: (1915020258)01110010001001001110001111100010 c: (4024023932)11101111110110011011101101111100 d: (3523939096)11010010000010110000101100011000 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (4139469664)11110110101110110100101101100000 Logic Function: (4014162037)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1367349718)01010001100000000001100111010110

47 MD5 Generation Iteration 1: Step 40 a = d, d = c, c = b, b = previous resulting value a: (3523939096)11010010000010110000101100011000 b: (1367349718)01010001100000000001100111010110 c: (1915020258)01110010001001001110001111100010 d: (4024023932)11101111110110011011101101111100 Data Block: (0)00000000000000000000000000000000 R Constant: (23)00000000000000000000000000010111 Sin Value: (3200236656)10111110101111111011110001110000 Logic Function: (3523939096)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3115236826)10111001101011101011110111011010

48 MD5 Generation Iteration 1: Step 41 a = d, d = c, c = b, b = previous resulting value a: (4024023932)11101111110110011011101101111100 b: (3115236826)10111001101011101011110111011010 c: (1367349718)01010001100000000001100111010110 d: (1915020258)01110010001001001110001111100010 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (681279174)00101000100110110111111011000110 Logic Function: (4024023932)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3785810149)11100001101001101110000011100101

49 MD5 Generation Iteration 1: Step 42 a = d, d = c, c = b, b = previous resulting value a: (1915020258)01110010001001001110001111100010 b: (3785810149)11100001101001101110000011100101 c: (3115236826)10111001101011101011110111011010 d: (1367349718)01010001100000000001100111010110 Data Block: (1936156275)01110011011001110110011001110011 R Constant: (11)00000000000000000000000000001011 Sin Value: (3936430074)11101010101000010010011111111010 Logic Function: (1915020258)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2405476274)10001111011000001010011110110010

50 MD5 Generation Iteration 1: Step 43 a = d, d = c, c = b, b = previous resulting value a: (1367349718)01010001100000000001100111010110 b: (2405476274)10001111011000001010011110110010 c: (3785810149)11100001101001101110000011100101 d: (3115236826)10111001101011101011110111011010 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (3572445317)11010100111011110011000010000101 Logic Function: (1367349718)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3561596298)11010100010010011010010110001010

51 MD5 Generation Iteration 1: Step 44 a = d, d = c, c = b, b = previous resulting value a: (3115236826)10111001101011101011110111011010 b: (3561596298)11010100010010011010010110001010 c: (2405476274)10001111011000001010011110110010 d: (3785810149)11100001101001101110000011100101 Data Block: (0)00000000000000000000000000000000 R Constant: (23)00000000000000000000000000010111 Sin Value: (76029189)00000100100010000001110100000101 Logic Function: (3115236826)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2995128552)10110010100001100000100011101000

52 MD5 Generation Iteration 1: Step 45 a = d, d = c, c = b, b = previous resulting value a: (3785810149)11100001101001101110000011100101 b: (2995128552)10110010100001100000100011101000 c: (3561596298)11010100010010011010010110001010 d: (2405476274)10001111011000001010011110110010 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (3654602809)11011001110101001101000000111001 Logic Function: (3785810149)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (87148498)00000101001100011100011111010010

53 MD5 Generation Iteration 1: Step 46 a = d, d = c, c = b, b = previous resulting value a: (2405476274)10001111011000001010011110110010 b: (87148498)00000101001100011100011111010010 c: (2995128552)10110010100001100000100011101000 d: (3561596298)11010100010010011010010110001010 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (3873151461)11100110110110111001100111100101 Logic Function: (2405476274)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3667134115)11011010100101000000011010100011

54 MD5 Generation Iteration 1: Step 47 a = d, d = c, c = b, b = previous resulting value a: (3561596298)11010100010010011010010110001010 b: (3667134115)11011010100101000000011010100011 c: (87148498)00000101001100011100011111010010 d: (2995128552)10110010100001100000100011101000 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (530742520)00011111101000100111110011111000 Logic Function: (3561596298)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3333384114)11000110101011110110011110110010

55 MD5 Generation Iteration 1: Step 48 a = d, d = c, c = b, b = previous resulting value a: (2995128552)10110010100001100000100011101000 b: (3333384114)11000110101011110110011110110010 c: (3667134115)11011010100101000000011010100011 d: (87148498)00000101001100011100011111010010 Data Block: (2154063718)10000000011001000110011101100110 R Constant: (23)00000000000000000000000000010111 Sin Value: (3299628645)11000100101011000101011001100101 Logic Function: (2995128552)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2176301160)10000001101101111011100001101000

56 MD5 Generation Iteration 1: Step 49 a = d, d = c, c = b, b = previous resulting value a: (87148498)00000101001100011100011111010010 b: (2176301160)10000001101101111011100001101000 c: (3333384114)11000110101011110110011110110010 d: (3667134115)11011010100101000000011010100011 Data Block: (1936156275)01110011011001110110011001110011 R Constant: (6)00000000000000000000000000000110 Sin Value: (4096336452)11110100001010010010001001000100 Logic Function: (87148498)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2255720028)10000110011100111000111001011100

57 MD5 Generation Iteration 1: Step 50 a = d, d = c, c = b, b = previous resulting value a: (3667134115)11011010100101000000011010100011 b: (2255720028)10000110011100111000111001011100 c: (2176301160)10000001101101111011100001101000 d: (3333384114)11000110101011110110011110110010 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (1126891415)01000011001010101111111110010111 Logic Function: (3667134115)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2468694990)10010011001001010100101111001110

58 MD5 Generation Iteration 1: Step 51 a = d, d = c, c = b, b = previous resulting value a: (3333384114)11000110101011110110011110110010 b: (2468694990)10010011001001010100101111001110 c: (2255720028)10000110011100111000111001011100 d: (2176301160)10000001101101111011100001101000 Data Block: (88)00000000000000000000000001011000 R Constant: (15)00000000000000000000000000001111 Sin Value: (2878612391)10101011100101000010001110100111 Logic Function: (3333384114)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (3116351871)10111001101111111100000101111111

59 MD5 Generation Iteration 1: Step 52 a = d, d = c, c = b, b = previous resulting value a: (2176301160)10000001101101111011100001101000 b: (3116351871)10111001101111111100000101111111 c: (2468694990)10010011001001010100101111001110 d: (2255720028)10000110011100111000111001011100 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (4237533241)11111100100100111010000000111001 Logic Function: (2176301160)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (337436225)00010100000111001101111001000001

60 MD5 Generation Iteration 1: Step 53 a = d, d = c, c = b, b = previous resulting value a: (2255720028)10000110011100111000111001011100 b: (337436225)00010100000111001101111001000001 c: (3116351871)10111001101111111100000101111111 d: (2468694990)10010011001001010100101111001110 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (1700485571)01100101010110110101100111000011 Logic Function: (2255720028)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1613146541)01100000001001101010100110101101

61 MD5 Generation Iteration 1: Step 54 a = d, d = c, c = b, b = previous resulting value a: (2468694990)10010011001001010100101111001110 b: (1613146541)01100000001001101010100110101101 c: (337436225)00010100000111001101111001000001 d: (3116351871)10111001101111111100000101111111 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (2399980690)10001111000011001100110010010010 Logic Function: (2468694990)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (303029247)00010010000011111101101111111111

62 MD5 Generation Iteration 1: Step 55 a = d, d = c, c = b, b = previous resulting value a: (3116351871)10111001101111111100000101111111 b: (303029247)00010010000011111101101111111111 c: (1613146541)01100000001001101010100110101101 d: (337436225)00010100000111001101111001000001 Data Block: (0)00000000000000000000000000000000 R Constant: (15)00000000000000000000000000001111 Sin Value: (4293915773)11111111111011111111010001111101 Logic Function: (3116351871)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2520188603)10010110001101110000011010111011

63 MD5 Generation Iteration 1: Step 56 a = d, d = c, c = b, b = previous resulting value a: (337436225)00010100000111001101111001000001 b: (2520188603)10010110001101110000011010111011 c: (303029247)00010010000011111101101111111111 d: (1613146541)01100000001001101010100110101101 Data Block: (1684498020)01100100011001110110011001100100 R Constant: (21)00000000000000000000000000010101 Sin Value: (2240044497)10000101100001000101110111010001 Logic Function: (337436225)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2240316896)10000101100010001000010111100000

64 MD5 Generation Iteration 1: Step 57 a = d, d = c, c = b, b = previous resulting value a: (1613146541)01100000001001101010100110101101 b: (2240316896)10000101100010001000010111100000 c: (2520188603)10010110001101110000011010111011 d: (303029247)00010010000011111101101111111111 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (1873313359)01101111101010000111111001001111 Logic Function: (1613146541)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1832606642)01101101001110110101101110110010

65 MD5 Generation Iteration 1: Step 58 a = d, d = c, c = b, b = previous resulting value a: (303029247)00010010000011111101101111111111 b: (1832606642)01101101001110110101101110110010 c: (2240316896)10000101100010001000010111100000 d: (2520188603)10010110001101110000011010111011 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (4264355552)11111110001011001110011011100000 Logic Function: (303029247)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (775893908)00101110001111110011001110010100

66 MD5 Generation Iteration 1: Step 59 a = d, d = c, c = b, b = previous resulting value a: (2520188603)10010110001101110000011010111011 b: (775893908)00101110001111110011001110010100 c: (1832606642)01101101001110110101101110110010 d: (2240316896)10000101100010001000010111100000 Data Block: (0)00000000000000000000000000000000 R Constant: (15)00000000000000000000000000001111 Sin Value: (2734768916)10100011000000010100001100010100 Logic Function: (2520188603)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1664965074)01100011001111010101100111010010

67 MD5 Generation Iteration 1: Step 60 a = d, d = c, c = b, b = previous resulting value a: (2240316896)10000101100010001000010111100000 b: (1664965074)01100011001111010101100111010010 c: (775893908)00101110001111110011001110010100 d: (1832606642)01101101001110110101101110110010 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (1309151649)01001110000010000001000110100001 Logic Function: (2240316896)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (483623998)00011100110100111000010000111110

68 MD5 Generation Iteration 1: Step 61 a = d, d = c, c = b, b = previous resulting value a: (1832606642)01101101001110110101101110110010 b: (483623998)00011100110100111000010000111110 c: (1664965074)01100011001111010101100111010010 d: (775893908)00101110001111110011001110010100 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (4149444226)11110111010100110111111010000010 Logic Function: (1832606642)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (4230970502)11111100001011110111110010000110

69 MD5 Generation Iteration 1: Step 62 a = d, d = c, c = b, b = previous resulting value a: (775893908)00101110001111110011001110010100 b: (4230970502)11111100001011110111110010000110 c: (483623998)00011100110100111000010000111110 d: (1664965074)01100011001111010101100111010010 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (3174756917)10111101001110101111001000110101 Logic Function: (775893908)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (3601917876)11010110101100001110011110110100

70 MD5 Generation Iteration 1: Step 63 a = d, d = c, c = b, b = previous resulting value a: (1664965074)01100011001111010101100111010010 b: (3601917876)11010110101100001110011110110100 c: (4230970502)11111100001011110111110010000110 d: (483623998)00011100110100111000010000111110 Data Block: (2154063718)10000000011001000110011101100110 R Constant: (15)00000000000000000000000000001111 Sin Value: (718787259)00101010110101111101001010111011 Logic Function: (1664965074)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1650717882)01100010011000111111010010111010

71 MD5 Generation Iteration 1: Step 64 a = d, d = c, c = b, b = previous resulting value a: (483623998)00011100110100111000010000111110 b: (1650717882)01100010011000111111010010111010 c: (3601917876)11010110101100001110011110110100 d: (4230970502)11111100001011110111110010000110 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (3951481745)11101011100001101101001110010001 Logic Function: (483623998)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1715185767)01100110001110111010100001100111

72 MD5 Generation After Iteration 1: Add the new result to the previous iteration's result h0 + A: 1668587399 h1 + B: 1443451888 h2 + C: 4213100984 h3 + D: 3873651754

73 MD5 Generation After all iterations are complete h0: 1668587399 (Hex: 879f7463) h1: 1443451888 (Hex: f0530956) h2: 4213100984 (Hex: b8d11efb) h3: 3873651754 (Hex: 2a3ce3e6) The final digest: 879f7463f0530956b8d11efb2a3ce3e6

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.

75


Download ppt "MD5 Generation Auto-Generated Slides To Visualize MD5 Hash Generation by Chris Fremgen."

Similar presentations


Ads by Google