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: 'hello' User Input Bytes: 104 101 108 108 111

6 MD5 Generation From User Input After Pre-Processing of data, Message Bytes: 104 101 108 108 111 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 40 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: (1819043176)01101100011011000110010101101000 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: (3679623978)11011011010100101001101100101010

9 MD5 Generation Iteration 1: Step 2 a = d, d = c, c = b, b = previous resulting value a: (271733878)00010000001100100101010001110110 b: (3679623978)11011011010100101001101100101010 c: (4023233417)11101111110011011010101110001001 d: (2562383102)10011000101110101101110011111110 Data Block: (32879)00000000000000001000000001101111 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: (286529400)00010001000101000001011101111000

10 MD5 Generation Iteration 1: Step 3 a = d, d = c, c = b, b = previous resulting value a: (2562383102)10011000101110101101110011111110 b: (286529400)00010001000101000001011101111000 c: (3679623978)11011011010100101001101100101010 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: (605655266)00100100000110011001000011100010

11 MD5 Generation Iteration 1: Step 4 a = d, d = c, c = b, b = previous resulting value a: (4023233417)11101111110011011010101110001001 b: (605655266)00100100000110011001000011100010 c: (286529400)00010001000101000001011101111000 d: (3679623978)11011011010100101001101100101010 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: (2617034823)10011011111111001100100001000111

12 MD5 Generation Iteration 1: Step 5 a = d, d = c, c = b, b = previous resulting value a: (3679623978)11011011010100101001101100101010 b: (2617034823)10011011111111001100100001000111 c: (605655266)00100100000110011001000011100010 d: (286529400)00010001000101000001011101111000 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (4118548399)11110101011111000000111110101111 Logic Function: (3679623978)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (262009391)00001111100111011111001000101111

13 MD5 Generation Iteration 1: Step 6 a = d, d = c, c = b, b = previous resulting value a: (286529400)00010001000101000001011101111000 b: (262009391)00001111100111011111001000101111 c: (2617034823)10011011111111001100100001000111 d: (605655266)00100100000110011001000011100010 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (1200080426)01000111100001111100011000101010 Logic Function: (286529400)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (2575600242)10011001100001001000101001110010

14 MD5 Generation Iteration 1: Step 7 a = d, d = c, c = b, b = previous resulting value a: (605655266)00100100000110011001000011100010 b: (2575600242)10011001100001001000101001110010 c: (262009391)00001111100111011111001000101111 d: (2617034823)10011011111111001100100001000111 Data Block: (0)00000000000000000000000000000000 R Constant: (17)00000000000000000000000000010001 Sin Value: (2821735955)10101000001100000100011000010011 Logic Function: (605655266)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3418241791)11001011101111100011101011111111

15 MD5 Generation Iteration 1: Step 8 a = d, d = c, c = b, b = previous resulting value a: (2617034823)10011011111111001100100001000111 b: (3418241791)11001011101111100011101011111111 c: (2575600242)10011001100001001000101001110010 d: (262009391)00001111100111011111001000101111 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (4249261313)11111101010001101001010100000001 Logic Function: (2617034823)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3125275976)10111010010001111110110101001000

16 MD5 Generation Iteration 1: Step 9 a = d, d = c, c = b, b = previous resulting value a: (262009391)00001111100111011111001000101111 b: (3125275976)10111010010001111110110101001000 c: (3418241791)11001011101111100011101011111111 d: (2575600242)10011001100001001000101001110010 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (1770035416)01101001100000001001100011011000 Logic Function: (262009391)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (211987914)00001100101000101010110111001010

17 MD5 Generation Iteration 1: Step 10 a = d, d = c, c = b, b = previous resulting value a: (2575600242)10011001100001001000101001110010 b: (211987914)00001100101000101010110111001010 c: (3125275976)10111010010001111110110101001000 d: (3418241791)11001011101111100011101011111111 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (2336552879)10001011010001001111011110101111 Logic Function: (2575600242)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (2428280008)10010000101111001001110011001000

18 MD5 Generation Iteration 1: Step 11 a = d, d = c, c = b, b = previous resulting value a: (3418241791)11001011101111100011101011111111 b: (2428280008)10010000101111001001110011001000 c: (211987914)00001100101000101010110111001010 d: (3125275976)10111010010001111110110101001000 Data Block: (0)00000000000000000000000000000000 R Constant: (17)00000000000000000000000000010001 Sin Value: (4294925233)11111111111111110101101110110001 Logic Function: (3418241791)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (2578352651)10011001101011101000101000001011

19 MD5 Generation Iteration 1: Step 12 a = d, d = c, c = b, b = previous resulting value a: (3125275976)10111010010001111110110101001000 b: (2578352651)10011001101011101000101000001011 c: (2428280008)10010000101111001001110011001000 d: (211987914)00001100101000101010110111001010 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (2304563134)10001001010111001101011110111110 Logic Function: (3125275976)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (1298439783)01001101011001001001111001100111

20 MD5 Generation Iteration 1: Step 13 a = d, d = c, c = b, b = previous resulting value a: (211987914)00001100101000101010110111001010 b: (1298439783)01001101011001001001111001100111 c: (2578352651)10011001101011101000101000001011 d: (2428280008)10010000101111001001110011001000 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (1804603682)01101011100100000001000100100010 Logic Function: (211987914)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (1158240751)01000101000010010101100111101111

21 MD5 Generation Iteration 1: Step 14 a = d, d = c, c = b, b = previous resulting value a: (2428280008)10010000101111001001110011001000 b: (1158240751)01000101000010010101100111101111 c: (1298439783)01001101011001001001111001100111 d: (2578352651)10011001101011101000101000001011 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (4254626195)11111101100110000111000110010011 Logic Function: (2428280008)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (4287987886)11111111100101011000000010101110

22 MD5 Generation Iteration 1: Step 15 a = d, d = c, c = b, b = previous resulting value a: (2578352651)10011001101011101000101000001011 b: (4287987886)11111111100101011000000010101110 c: (1158240751)01000101000010010101100111101111 d: (1298439783)01001101011001001001111001100111 Data Block: (40)00000000000000000000000000101000 R Constant: (17)00000000000000000000000000010001 Sin Value: (2792965006)10100110011110010100001110001110 Logic Function: (2578352651)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3640036287)11011000111101101000101110111111

23 MD5 Generation Iteration 1: Step 16 a = d, d = c, c = b, b = previous resulting value a: (1298439783)01001101011001001001111001100111 b: (3640036287)11011000111101101000101110111111 c: (4287987886)11111111100101011000000010101110 d: (1158240751)01000101000010010101100111101111 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (1236535329)01001001101101000000100000100001 Logic Function: (1298439783)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3063134556)10110110100100111011100101011100

24 MD5 Generation Iteration 1: Step 17 a = d, d = c, c = b, b = previous resulting value a: (1158240751)01000101000010010101100111101111 b: (3063134556)10110110100100111011100101011100 c: (3640036287)11011000111101101000101110111111 d: (4287987886)11111111100101011000000010101110 Data Block: (32879)00000000000000001000000001101111 R Constant: (5)00000000000000000000000000000101 Sin Value: (4129170786)11110110000111100010010101100010 Logic Function: (1158240751)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (4194637082)11111010000001010001010100011010

25 MD5 Generation Iteration 1: Step 18 a = d, d = c, c = b, b = previous resulting value a: (4287987886)11111111100101011000000010101110 b: (4194637082)11111010000001010001010100011010 c: (3063134556)10110110100100111011100101011100 d: (3640036287)11011000111101101000101110111111 Data Block: (0)00000000000000000000000000000000 R Constant: (9)00000000000000000000000000001001 Sin Value: (3225465664)11000000010000001011001101000000 Logic Function: (4287987886)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2966398613)10110000110011111010011010010101

26 MD5 Generation Iteration 1: Step 19 a = d, d = c, c = b, b = previous resulting value a: (3640036287)11011000111101101000101110111111 b: (2966398613)10110000110011111010011010010101 c: (4194637082)11111010000001010001010100011010 d: (3063134556)10110110100100111011100101011100 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (643717713)00100110010111100101101001010001 Logic Function: (3640036287)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3545851020)11010011010110010110010010001100

27 MD5 Generation Iteration 1: Step 20 a = d, d = c, c = b, b = previous resulting value a: (3063134556)10110110100100111011100101011100 b: (3545851020)11010011010110010110010010001100 c: (2966398613)10110000110011111010011010010101 d: (4194637082)11111010000001010001010100011010 Data Block: (1819043176)01101100011011000110010101101000 R Constant: (20)00000000000000000000000000010100 Sin Value: (3921069994)11101001101101101100011110101010 Logic Function: (3063134556)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2736217268)10100011000101110101110010110100

28 MD5 Generation Iteration 1: Step 21 a = d, d = c, c = b, b = previous resulting value a: (4194637082)11111010000001010001010100011010 b: (2736217268)10100011000101110101110010110100 c: (3545851020)11010011010110010110010010001100 d: (2966398613)10110000110011111010011010010101 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (3593408605)11010110001011110001000001011101 Logic Function: (4194637082)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (210018090)00001100100001001001111100101010

29 MD5 Generation Iteration 1: Step 22 a = d, d = c, c = b, b = previous resulting value a: (2966398613)10110000110011111010011010010101 b: (210018090)00001100100001001001111100101010 c: (2736217268)10100011000101110101110010110100 d: (3545851020)11010011010110010110010010001100 Data Block: (0)00000000000000000000000000000000 R Constant: (9)00000000000000000000000000001001 Sin Value: (38016083)00000010010001000001010001010011 Logic Function: (2966398613)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1077076176)01000000001100101110000011010000

30 MD5 Generation Iteration 1: Step 23 a = d, d = c, c = b, b = previous resulting value a: (3545851020)11010011010110010110010010001100 b: (1077076176)01000000001100101110000011010000 c: (210018090)00001100100001001001111100101010 d: (2736217268)10100011000101110101110010110100 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (3634488961)11011000101000011110011010000001 Logic Function: (3545851020)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3286028019)11000011110111001100111011110011

31 MD5 Generation Iteration 1: Step 24 a = d, d = c, c = b, b = previous resulting value a: (2736217268)10100011000101110101110010110100 b: (3286028019)11000011110111001100111011110011 c: (1077076176)01000000001100101110000011010000 d: (210018090)00001100100001001001111100101010 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (3889429448)11100111110100111111101111001000 Logic Function: (2736217268)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (986286359)00111010110010011000100100010111

32 MD5 Generation Iteration 1: Step 25 a = d, d = c, c = b, b = previous resulting value a: (210018090)00001100100001001001111100101010 b: (986286359)00111010110010011000100100010111 c: (3286028019)11000011110111001100111011110011 d: (1077076176)01000000001100101110000011010000 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (568446438)00100001111000011100110111100110 Logic Function: (210018090)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2166944141)10000001001010001111000110001101

33 MD5 Generation Iteration 1: Step 26 a = d, d = c, c = b, b = previous resulting value a: (1077076176)01000000001100101110000011010000 b: (2166944141)10000001001010001111000110001101 c: (986286359)00111010110010011000100100010111 d: (3286028019)11000011110111001100111011110011 Data Block: (40)00000000000000000000000000101000 R Constant: (9)00000000000000000000000000001001 Sin Value: (3275163606)11000011001101110000011111010110 Logic Function: (1077076176)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1753061637)01101000011111011001100100000101

34 MD5 Generation Iteration 1: Step 27 a = d, d = c, c = b, b = previous resulting value a: (3286028019)11000011110111001100111011110011 b: (1753061637)01101000011111011001100100000101 c: (2166944141)10000001001010001111000110001101 d: (986286359)00111010110010011000100100010111 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (4107603335)11110100110101010000110110000111 Logic Function: (3286028019)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1577021835)01011101111111110111000110001011

35 MD5 Generation Iteration 1: Step 28 a = d, d = c, c = b, b = previous resulting value a: (986286359)00111010110010011000100100010111 b: (1577021835)01011101111111110111000110001011 c: (1753061637)01101000011111011001100100000101 d: (2166944141)10000001001010001111000110001101 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (1163531501)01000101010110100001010011101101 Logic Function: (986286359)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3604876188)11010110110111100000101110011100

36 MD5 Generation Iteration 1: Step 29 a = d, d = c, c = b, b = previous resulting value a: (2166944141)10000001001010001111000110001101 b: (3604876188)11010110110111100000101110011100 c: (1577021835)01011101111111110111000110001011 d: (1753061637)01101000011111011001100100000101 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (2850285829)10101001111000111110100100000101 Logic Function: (2166944141)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (4098265004)11110100010001101000111110101100

37 MD5 Generation Iteration 1: Step 30 a = d, d = c, c = b, b = previous resulting value a: (1753061637)01101000011111011001100100000101 b: (4098265004)11110100010001101000111110101100 c: (3604876188)11010110110111100000101110011100 d: (1577021835)01011101111111110111000110001011 Data Block: (0)00000000000000000000000000000000 R Constant: (9)00000000000000000000000000001001 Sin Value: (4243563512)11111100111011111010001111111000 Logic Function: (1753061637)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1524089379)01011010110101111100001000100011

38 MD5 Generation Iteration 1: Step 31 a = d, d = c, c = b, b = previous resulting value a: (1577021835)01011101111111110111000110001011 b: (1524089379)01011010110101111100001000100011 c: (4098265004)11110100010001101000111110101100 d: (3604876188)11010110110111100000101110011100 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (1735328473)01100111011011110000001011011001 Logic Function: (1577021835)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2574831668)10011001011110001101000000110100

39 MD5 Generation Iteration 1: Step 32 a = d, d = c, c = b, b = previous resulting value a: (3604876188)11010110110111100000101110011100 b: (2574831668)10011001011110001101000000110100 c: (1524089379)01011010110101111100001000100011 d: (4098265004)11110100010001101000111110101100 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (2368359562)10001101001010100100110010001010 Logic Function: (3604876188)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (509132245)00011110010110001011110111010101

40 MD5 Generation Iteration 1: Step 33 a = d, d = c, c = b, b = previous resulting value a: (4098265004)11110100010001101000111110101100 b: (509132245)00011110010110001011110111010101 c: (2574831668)10011001011110001101000000110100 d: (1524089379)01011010110101111100001000100011 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (4294588738)11111111111110100011100101000010 Logic Function: (4098265004)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1105217762)01000001111000000100100011100010

41 MD5 Generation Iteration 1: Step 34 a = d, d = c, c = b, b = previous resulting value a: (1524089379)01011010110101111100001000100011 b: (1105217762)01000001111000000100100011100010 c: (509132245)00011110010110001011110111010101 d: (2574831668)10011001011110001101000000110100 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (2272392833)10000111011100011111011010000001 Logic Function: (1524089379)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2429388330)10010000110011011000011000101010

42 MD5 Generation Iteration 1: Step 35 a = d, d = c, c = b, b = previous resulting value a: (2574831668)10011001011110001101000000110100 b: (2429388330)10010000110011011000011000101010 c: (1105217762)01000001111000000100100011100010 d: (509132245)00011110010110001011110111010101 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (1839030562)01101101100111010110000100100010 Logic Function: (2574831668)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (893476021)00110101010000010101110010110101

43 MD5 Generation Iteration 1: Step 36 a = d, d = c, c = b, b = previous resulting value a: (509132245)00011110010110001011110111010101 b: (893476021)00110101010000010101110010110101 c: (2429388330)10010000110011011000011000101010 d: (1105217762)01000001111000000100100011100010 Data Block: (40)00000000000000000000000000101000 R Constant: (23)00000000000000000000000000010111 Sin Value: (4259657740)11111101111001010011100000001100 Logic Function: (509132245)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2017571321)01111000010000011011000111111001

44 MD5 Generation Iteration 1: Step 37 a = d, d = c, c = b, b = previous resulting value a: (1105217762)01000001111000000100100011100010 b: (2017571321)01111000010000011011000111111001 c: (893476021)00110101010000010101110010110101 d: (2429388330)10010000110011011000011000101010 Data Block: (32879)00000000000000001000000001101111 R Constant: (4)00000000000000000000000000000100 Sin Value: (2763975236)10100100101111101110101001000100 Logic Function: (1105217762)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3205734837)10111111000100111010000110110101

45 MD5 Generation Iteration 1: Step 38 a = d, d = c, c = b, b = previous resulting value a: (2429388330)10010000110011011000011000101010 b: (3205734837)10111111000100111010000110110101 c: (2017571321)01111000010000011011000111111001 d: (893476021)00110101010000010101110010110101 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (1272893353)01001011110111101100111110101001 Logic Function: (2429388330)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3156871210)10111100001010100000100000101010

46 MD5 Generation Iteration 1: Step 39 a = d, d = c, c = b, b = previous resulting value a: (893476021)00110101010000010101110010110101 b: (3156871210)10111100001010100000100000101010 c: (3205734837)10111111000100111010000110110101 d: (2017571321)01111000010000011011000111111001 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (4139469664)11110110101110110100101101100000 Logic Function: (893476021)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2091233182)01111100101001011010111110011110

47 MD5 Generation Iteration 1: Step 40 a = d, d = c, c = b, b = previous resulting value a: (2017571321)01111000010000011011000111111001 b: (2091233182)01111100101001011010111110011110 c: (3156871210)10111100001010100000100000101010 d: (3205734837)10111111000100111010000110110101 Data Block: (0)00000000000000000000000000000000 R Constant: (23)00000000000000000000000000010111 Sin Value: (3200236656)10111110101111111011110001110000 Logic Function: (2017571321)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2986409560)10110010000000001111111001011000

48 MD5 Generation Iteration 1: Step 41 a = d, d = c, c = b, b = previous resulting value a: (3205734837)10111111000100111010000110110101 b: (2986409560)10110010000000001111111001011000 c: (2091233182)01111100101001011010111110011110 d: (3156871210)10111100001010100000100000101010 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (681279174)00101000100110110111111011000110 Logic Function: (3205734837)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1441309901)01010101111010001010010011001101

49 MD5 Generation Iteration 1: Step 42 a = d, d = c, c = b, b = previous resulting value a: (3156871210)10111100001010100000100000101010 b: (1441309901)01010101111010001010010011001101 c: (2986409560)10110010000000001111111001011000 d: (2091233182)01111100101001011010111110011110 Data Block: (1819043176)01101100011011000110010101101000 R Constant: (11)00000000000000000000000000001011 Sin Value: (3936430074)11101010101000010010011111111010 Logic Function: (3156871210)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2185060929)10000010001111010110001001000001

50 MD5 Generation Iteration 1: Step 43 a = d, d = c, c = b, b = previous resulting value a: (2091233182)01111100101001011010111110011110 b: (2185060929)10000010001111010110001001000001 c: (1441309901)01010101111010001010010011001101 d: (2986409560)10110010000000001111111001011000 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (3572445317)11010100111011110011000010000101 Logic Function: (2091233182)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2603948459)10011011001101010001100110101011

51 MD5 Generation Iteration 1: Step 44 a = d, d = c, c = b, b = previous resulting value a: (2986409560)10110010000000001111111001011000 b: (2603948459)10011011001101010001100110101011 c: (2185060929)10000010001111010110001001000001 d: (1441309901)01010101111010001010010011001101 Data Block: (0)00000000000000000000000000000000 R Constant: (23)00000000000000000000000000010111 Sin Value: (76029189)00000100100010000001110100000101 Logic Function: (2986409560)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3711356584)11011101001101101100111010101000

52 MD5 Generation Iteration 1: Step 45 a = d, d = c, c = b, b = previous resulting value a: (1441309901)01010101111010001010010011001101 b: (3711356584)11011101001101101100111010101000 c: (2603948459)10011011001101010001100110101011 d: (2185060929)10000010001111010110001001000001 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (3654602809)11011001110101001101000000111001 Logic Function: (1441309901)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (486110007)00011100111110010111001100110111

53 MD5 Generation Iteration 1: Step 46 a = d, d = c, c = b, b = previous resulting value a: (2185060929)10000010001111010110001001000001 b: (486110007)00011100111110010111001100110111 c: (3711356584)11011101001101101100111010101000 d: (2603948459)10011011001101010001100110101011 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (3873151461)11100110110110111001100111100101 Logic Function: (2185060929)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3120318807)10111001111111000100100101010111

54 MD5 Generation Iteration 1: Step 47 a = d, d = c, c = b, b = previous resulting value a: (2603948459)10011011001101010001100110101011 b: (3120318807)10111001111111000100100101010111 c: (486110007)00011100111110010111001100110111 d: (3711356584)11011101001101101100111010101000 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (530742520)00011111101000100111110011111000 Logic Function: (2603948459)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1164409954)01000101011001110111110001100010

55 MD5 Generation Iteration 1: Step 48 a = d, d = c, c = b, b = previous resulting value a: (3711356584)11011101001101101100111010101000 b: (1164409954)01000101011001110111110001100010 c: (3120318807)10111001111111000100100101010111 d: (486110007)00011100111110010111001100110111 Data Block: (0)00000000000000000000000000000000 R Constant: (23)00000000000000000000000000010111 Sin Value: (3299628645)11000100101011000101011001100101 Logic Function: (3711356584)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3441991447)11001101001010001001111100010111

56 MD5 Generation Iteration 1: Step 49 a = d, d = c, c = b, b = previous resulting value a: (486110007)00011100111110010111001100110111 b: (3441991447)11001101001010001001111100010111 c: (1164409954)01000101011001110111110001100010 d: (3120318807)10111001111111000100100101010111 Data Block: (1819043176)01101100011011000110010101101000 R Constant: (6)00000000000000000000000000000110 Sin Value: (4096336452)11110100001010010010001001000100 Logic Function: (486110007)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (3289927448)11000100000110000100111100011000

57 MD5 Generation Iteration 1: Step 50 a = d, d = c, c = b, b = previous resulting value a: (3120318807)10111001111111000100100101010111 b: (3289927448)11000100000110000100111100011000 c: (3441991447)11001101001010001001111100010111 d: (1164409954)01000101011001110111110001100010 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (1126891415)01000011001010101111111110010111 Logic Function: (3120318807)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (578695131)00100010011111100010111111011011

58 MD5 Generation Iteration 1: Step 51 a = d, d = c, c = b, b = previous resulting value a: (1164409954)01000101011001110111110001100010 b: (578695131)00100010011111100010111111011011 c: (3289927448)11000100000110000100111100011000 d: (3441991447)11001101001010001001111100010111 Data Block: (40)00000000000000000000000000101000 R Constant: (15)00000000000000000000000000001111 Sin Value: (2878612391)10101011100101000010001110100111 Logic Function: (1164409954)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2198381516)10000011000010001010001111001100

59 MD5 Generation Iteration 1: Step 52 a = d, d = c, c = b, b = previous resulting value a: (3441991447)11001101001010001001111100010111 b: (2198381516)10000011000010001010001111001100 c: (578695131)00100010011111100010111111011011 d: (3289927448)11000100000110000100111100011000 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (4237533241)11111100100100111010000000111001 Logic Function: (3441991447)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (4086631815)11110011100101010000110110000111

60 MD5 Generation Iteration 1: Step 53 a = d, d = c, c = b, b = previous resulting value a: (3289927448)11000100000110000100111100011000 b: (4086631815)11110011100101010000110110000111 c: (2198381516)10000011000010001010001111001100 d: (578695131)00100010011111100010111111011011 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (1700485571)01100101010110110101100111000011 Logic Function: (3289927448)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2011094832)01110111110111101101111100110000

61 MD5 Generation Iteration 1: Step 54 a = d, d = c, c = b, b = previous resulting value a: (578695131)00100010011111100010111111011011 b: (2011094832)01110111110111101101111100110000 c: (4086631815)11110011100101010000110110000111 d: (2198381516)10000011000010001010001111001100 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (2399980690)10001111000011001100110010010010 Logic Function: (578695131)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1327195175)01001111000110110110010000100111

62 MD5 Generation Iteration 1: Step 55 a = d, d = c, c = b, b = previous resulting value a: (2198381516)10000011000010001010001111001100 b: (1327195175)01001111000110110110010000100111 c: (2011094832)01110111110111101101111100110000 d: (4086631815)11110011100101010000110110000111 Data Block: (0)00000000000000000000000000000000 R Constant: (15)00000000000000000000000000001111 Sin Value: (4293915773)11111111111011111111010001111101 Logic Function: (2198381516)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (803717621)00101111111001111100000111110101

63 MD5 Generation Iteration 1: Step 56 a = d, d = c, c = b, b = previous resulting value a: (4086631815)11110011100101010000110110000111 b: (803717621)00101111111001111100000111110101 c: (1327195175)01001111000110110110010000100111 d: (2011094832)01110111110111101101111100110000 Data Block: (32879)00000000000000001000000001101111 R Constant: (21)00000000000000000000000000010101 Sin Value: (2240044497)10000101100001000101110111010001 Logic Function: (4086631815)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1674773699)01100011110100110000010011000011

64 MD5 Generation Iteration 1: Step 57 a = d, d = c, c = b, b = previous resulting value a: (2011094832)01110111110111101101111100110000 b: (1674773699)01100011110100110000010011000011 c: (803717621)00101111111001111100000111110101 d: (1327195175)01001111000110110110010000100111 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (1873313359)01101111101010000111111001001111 Logic Function: (2011094832)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1237446707)01001001110000011111000000110011

65 MD5 Generation Iteration 1: Step 58 a = d, d = c, c = b, b = previous resulting value a: (1327195175)01001111000110110110010000100111 b: (1237446707)01001001110000011111000000110011 c: (1674773699)01100011110100110000010011000011 d: (803717621)00101111111001111100000111110101 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (4264355552)11111110001011001110011011100000 Logic Function: (1327195175)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2530864208)10010110110110011110110001010000

66 MD5 Generation Iteration 1: Step 59 a = d, d = c, c = b, b = previous resulting value a: (803717621)00101111111001111100000111110101 b: (2530864208)10010110110110011110110001010000 c: (1237446707)01001001110000011111000000110011 d: (1674773699)01100011110100110000010011000011 Data Block: (0)00000000000000000000000000000000 R Constant: (15)00000000000000000000000000001111 Sin Value: (2734768916)10100011000000010100001100010100 Logic Function: (803717621)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (554058082)00100001000001100100000101100010

67 MD5 Generation Iteration 1: Step 60 a = d, d = c, c = b, b = previous resulting value a: (1674773699)01100011110100110000010011000011 b: (554058082)00100001000001100100000101100010 c: (2530864208)10010110110110011110110001010000 d: (1237446707)01001001110000011111000000110011 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (1309151649)01001110000010000001000110100001 Logic Function: (1674773699)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1700837817)01100101011000001011100110111001

68 MD5 Generation Iteration 1: Step 61 a = d, d = c, c = b, b = previous resulting value a: (1237446707)01001001110000011111000000110011 b: (1700837817)01100101011000001011100110111001 c: (554058082)00100001000001100100000101100010 d: (2530864208)10010110110110011110110001010000 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (4149444226)11110111010100110111111010000010 Logic Function: (1237446707)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (3271237212)11000010111110110001111001011100

69 MD5 Generation Iteration 1: Step 62 a = d, d = c, c = b, b = previous resulting value a: (2530864208)10010110110110011110110001010000 b: (3271237212)11000010111110110001111001011100 c: (1700837817)01100101011000001011100110111001 d: (554058082)00100001000001100100000101100010 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (3174756917)10111101001110101111001000110101 Logic Function: (2530864208)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2190656154)10000010100100101100001010011010

70 MD5 Generation Iteration 1: Step 63 a = d, d = c, c = b, b = previous resulting value a: (554058082)00100001000001100100000101100010 b: (2190656154)10000010100100101100001010011010 c: (3271237212)11000010111110110001111001011100 d: (1700837817)01100101011000001011100110111001 Data Block: (0)00000000000000000000000000000000 R Constant: (15)00000000000000000000000000001111 Sin Value: (718787259)00101010110101111101001010111011 Logic Function: (554058082)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (4175598779)11111000111000101001010010111011

71 MD5 Generation Iteration 1: Step 64 a = d, d = c, c = b, b = previous resulting value a: (1700837817)01100101011000001011100110111001 b: (4175598779)11111000111000101001010010111011 c: (2190656154)10000010100100101100001010011010 d: (3271237212)11000010111110110001111001011100 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (3951481745)11101011100001101101001110010001 Logic Function: (1700837817)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2254217267)10000110010111001010000000110011

72 MD5 Generation After Iteration 1: Add the new result to the previous iteration's result h0 + A: 708854109 h1 + B: 1982483388 h2 + C: 2443014585 h3 + D: 2462390032

73 MD5 Generation After all iterations are complete h0: 708854109 (Hex: 5d41402a) h1: 1982483388 (Hex: bc4b2a76) h2: 2443014585 (Hex: b9719d91) h3: 2462390032 (Hex: 1017c592) The final digest: 5d41402abc4b2a76b9719d911017c592

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