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

6 MD5 Generation From User Input After Pre-Processing of data, Message Bytes: 97 100 102 115 100 102 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 48 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: (1936090209)01110011011001100110010001100001 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: (1481775022)01011000010100100001011110101110

9 MD5 Generation Iteration 1: Step 2 a = d, d = c, c = b, b = previous resulting value a: (271733878)00010000001100100101010001110110 b: (1481775022)01011000010100100001011110101110 c: (4023233417)11101111110011011010101110001001 d: (2562383102)10011000101110101101110011111110 Data Block: (8414820)00000000100000000110011001100100 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: (2352128980)10001100001100101010001111010100

10 MD5 Generation Iteration 1: Step 3 a = d, d = c, c = b, b = previous resulting value a: (2562383102)10011000101110101101110011111110 b: (2352128980)10001100001100101010001111010100 c: (1481775022)01011000010100100001011110101110 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: (1056896328)00111110111111101111010101001000

11 MD5 Generation Iteration 1: Step 4 a = d, d = c, c = b, b = previous resulting value a: (4023233417)11101111110011011010101110001001 b: (1056896328)00111110111111101111010101001000 c: (2352128980)10001100001100101010001111010100 d: (1481775022)01011000010100100001011110101110 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: (3598607567)11010110011111100110010011001111

12 MD5 Generation Iteration 1: Step 5 a = d, d = c, c = b, b = previous resulting value a: (1481775022)01011000010100100001011110101110 b: (3598607567)11010110011111100110010011001111 c: (1056896328)00111110111111101111010101001000 d: (2352128980)10001100001100101010001111010100 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (4118548399)11110101011111000000111110101111 Logic Function: (1481775022)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (4245012357)11111101000001011011111110000101

13 MD5 Generation Iteration 1: Step 6 a = d, d = c, c = b, b = previous resulting value a: (2352128980)10001100001100101010001111010100 b: (4245012357)11111101000001011011111110000101 c: (3598607567)11010110011111100110010011001111 d: (1056896328)00111110111111101111010101001000 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (1200080426)01000111100001111100011000101010 Logic Function: (2352128980)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (2314369584)10001001111100100111101000110000

14 MD5 Generation Iteration 1: Step 7 a = d, d = c, c = b, b = previous resulting value a: (1056896328)00111110111111101111010101001000 b: (2314369584)10001001111100100111101000110000 c: (4245012357)11111101000001011011111110000101 d: (3598607567)11010110011111100110010011001111 Data Block: (0)00000000000000000000000000000000 R Constant: (17)00000000000000000000000000010001 Sin Value: (2821735955)10101000001100000100011000010011 Logic Function: (1056896328)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (2118649510)01111110010010000000011010100110

15 MD5 Generation Iteration 1: Step 8 a = d, d = c, c = b, b = previous resulting value a: (3598607567)11010110011111100110010011001111 b: (2118649510)01111110010010000000011010100110 c: (2314369584)10001001111100100111101000110000 d: (4245012357)11111101000001011011111110000101 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (4249261313)11111101010001101001010100000001 Logic Function: (3598607567)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3131001171)10111010100111110100100101010011

16 MD5 Generation Iteration 1: Step 9 a = d, d = c, c = b, b = previous resulting value a: (4245012357)11111101000001011011111110000101 b: (3131001171)10111010100111110100100101010011 c: (2118649510)01111110010010000000011010100110 d: (2314369584)10001001111100100111101000110000 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (1770035416)01101001100000001001100011011000 Logic Function: (4245012357)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (2984544547)10110001111001001000100100100011

17 MD5 Generation Iteration 1: Step 10 a = d, d = c, c = b, b = previous resulting value a: (2314369584)10001001111100100111101000110000 b: (2984544547)10110001111001001000100100100011 c: (3131001171)10111010100111110100100101010011 d: (2118649510)01111110010010000000011010100110 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (2336552879)10001011010001001111011110101111 Logic Function: (2314369584)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3925535327)11101001111110101110101001011111

18 MD5 Generation Iteration 1: Step 11 a = d, d = c, c = b, b = previous resulting value a: (2118649510)01111110010010000000011010100110 b: (3925535327)11101001111110101110101001011111 c: (2984544547)10110001111001001000100100100011 d: (3131001171)10111010100111110100100101010011 Data Block: (0)00000000000000000000000000000000 R Constant: (17)00000000000000000000000000010001 Sin Value: (4294925233)11111111111111110101101110110001 Logic Function: (2118649510)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3232714424)11000000101011110100111010111000

19 MD5 Generation Iteration 1: Step 12 a = d, d = c, c = b, b = previous resulting value a: (3131001171)10111010100111110100100101010011 b: (3232714424)11000000101011110100111010111000 c: (3925535327)11101001111110101110101001011111 d: (2984544547)10110001111001001000100100100011 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (2304563134)10001001010111001101011110111110 Logic Function: (3131001171)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (3418146931)11001011101111001100100001110011

20 MD5 Generation Iteration 1: Step 13 a = d, d = c, c = b, b = previous resulting value a: (2984544547)10110001111001001000100100100011 b: (3418146931)11001011101111001100100001110011 c: (3232714424)11000000101011110100111010111000 d: (3925535327)11101001111110101110101001011111 Data Block: (0)00000000000000000000000000000000 R Constant: (7)00000000000000000000000000000111 Sin Value: (1804603682)01101011100100000001000100100010 Logic Function: (2984544547)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (4248766834)11111101001111110000100101110010

21 MD5 Generation Iteration 1: Step 14 a = d, d = c, c = b, b = previous resulting value a: (3925535327)11101001111110101110101001011111 b: (4248766834)11111101001111110000100101110010 c: (3418146931)11001011101111001100100001110011 d: (3232714424)11000000101011110100111010111000 Data Block: (0)00000000000000000000000000000000 R Constant: (12)00000000000000000000000000001100 Sin Value: (4254626195)11111101100110000111000110010011 Logic Function: (3925535327)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (4159558790)11110111111011011101010010000110

22 MD5 Generation Iteration 1: Step 15 a = d, d = c, c = b, b = previous resulting value a: (3232714424)11000000101011110100111010111000 b: (4159558790)11110111111011011101010010000110 c: (4248766834)11111101001111110000100101110010 d: (3418146931)11001011101111001100100001110011 Data Block: (48)00000000000000000000000000110000 R Constant: (17)00000000000000000000000000010001 Sin Value: (2792965006)10100110011110010100001110001110 Logic Function: (3232714424)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (767597905)00101101110000001001110101010001

23 MD5 Generation Iteration 1: Step 16 a = d, d = c, c = b, b = previous resulting value a: (3418146931)11001011101111001100100001110011 b: (767597905)00101101110000001001110101010001 c: (4159558790)11110111111011011101010010000110 d: (4248766834)11111101001111110000100101110010 Data Block: (0)00000000000000000000000000000000 R Constant: (22)00000000000000000000000000010110 Sin Value: (1236535329)01001001101101000000100000100001 Logic Function: (3418146931)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: (1531148650)01011011010000110111100101101010

24 MD5 Generation Iteration 1: Step 17 a = d, d = c, c = b, b = previous resulting value a: (4248766834)11111101001111110000100101110010 b: (1531148650)01011011010000110111100101101010 c: (767597905)00101101110000001001110101010001 d: (4159558790)11110111111011011101010010000110 Data Block: (8414820)00000000100000000110011001100100 R Constant: (5)00000000000000000000000000000101 Sin Value: (4129170786)11110110000111100010010101100010 Logic Function: (4248766834)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1059146451)00111111001000010100101011010011

25 MD5 Generation Iteration 1: Step 18 a = d, d = c, c = b, b = previous resulting value a: (4159558790)11110111111011011101010010000110 b: (1059146451)00111111001000010100101011010011 c: (1531148650)01011011010000110111100101101010 d: (767597905)00101101110000001001110101010001 Data Block: (0)00000000000000000000000000000000 R Constant: (9)00000000000000000000000000001001 Sin Value: (3225465664)11000000010000001011001101000000 Logic Function: (4159558790)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2734804289)10100011000000011100110101000001

26 MD5 Generation Iteration 1: Step 19 a = d, d = c, c = b, b = previous resulting value a: (767597905)00101101110000001001110101010001 b: (2734804289)10100011000000011100110101000001 c: (1059146451)00111111001000010100101011010011 d: (1531148650)01011011010000110111100101101010 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (643717713)00100110010111100101101001010001 Logic Function: (767597905)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3017714705)10110011110111101010110000010001

27 MD5 Generation Iteration 1: Step 20 a = d, d = c, c = b, b = previous resulting value a: (1531148650)01011011010000110111100101101010 b: (3017714705)10110011110111101010110000010001 c: (2734804289)10100011000000011100110101000001 d: (1059146451)00111111001000010100101011010011 Data Block: (1936090209)01110011011001100110010001100001 R Constant: (20)00000000000000000000000000010100 Sin Value: (3921069994)11101001101101101100011110101010 Logic Function: (1531148650)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3695534628)11011100010001010110001000100100

28 MD5 Generation Iteration 1: Step 21 a = d, d = c, c = b, b = previous resulting value a: (1059146451)00111111001000010100101011010011 b: (3695534628)11011100010001010110001000100100 c: (3017714705)10110011110111101010110000010001 d: (2734804289)10100011000000011100110101000001 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (3593408605)11010110001011110001000001011101 Logic Function: (1059146451)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2721892920)10100010001111001100101000111000

29 MD5 Generation Iteration 1: Step 22 a = d, d = c, c = b, b = previous resulting value a: (2734804289)10100011000000011100110101000001 b: (2721892920)10100010001111001100101000111000 c: (3695534628)11011100010001010110001000100100 d: (3017714705)10110011110111101010110000010001 Data Block: (0)00000000000000000000000000000000 R Constant: (9)00000000000000000000000000001001 Sin Value: (38016083)00000010010001000001010001010011 Logic Function: (2734804289)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1771330398)01101001100101000101101101011110

30 MD5 Generation Iteration 1: Step 23 a = d, d = c, c = b, b = previous resulting value a: (3017714705)10110011110111101010110000010001 b: (1771330398)01101001100101000101101101011110 c: (2721892920)10100010001111001100101000111000 d: (3695534628)11011100010001010110001000100100 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (3634488961)11011000101000011110011010000001 Logic Function: (3017714705)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3233814797)11000000110000000001100100001101

31 MD5 Generation Iteration 1: Step 24 a = d, d = c, c = b, b = previous resulting value a: (3695534628)11011100010001010110001000100100 b: (3233814797)11000000110000000001100100001101 c: (1771330398)01101001100101000101101101011110 d: (2721892920)10100010001111001100101000111000 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (3889429448)11100111110100111111101111001000 Logic Function: (3695534628)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (879293092)00110100011010001111001010100100

32 MD5 Generation Iteration 1: Step 25 a = d, d = c, c = b, b = previous resulting value a: (2721892920)10100010001111001100101000111000 b: (879293092)00110100011010001111001010100100 c: (3233814797)11000000110000000001100100001101 d: (1771330398)01101001100101000101101101011110 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (568446438)00100001111000011100110111100110 Logic Function: (2721892920)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (3225827088)11000000010001100011011100010000

33 MD5 Generation Iteration 1: Step 26 a = d, d = c, c = b, b = previous resulting value a: (1771330398)01101001100101000101101101011110 b: (3225827088)11000000010001100011011100010000 c: (879293092)00110100011010001111001010100100 d: (3233814797)11000000110000000001100100001101 Data Block: (48)00000000000000000000000000110000 R Constant: (9)00000000000000000000000000001001 Sin Value: (3275163606)11000011001101110000011111010110 Logic Function: (1771330398)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (687095634)00101000111101000011111101010010

34 MD5 Generation Iteration 1: Step 27 a = d, d = c, c = b, b = previous resulting value a: (3233814797)11000000110000000001100100001101 b: (687095634)00101000111101000011111101010010 c: (3225827088)11000000010001100011011100010000 d: (879293092)00110100011010001111001010100100 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (4107603335)11110100110101010000110110000111 Logic Function: (3233814797)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (6120656)00000000010111010110010011010000

35 MD5 Generation Iteration 1: Step 28 a = d, d = c, c = b, b = previous resulting value a: (879293092)00110100011010001111001010100100 b: (6120656)00000000010111010110010011010000 c: (687095634)00101000111101000011111101010010 d: (3225827088)11000000010001100011011100010000 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (1163531501)01000101010110100001010011101101 Logic Function: (879293092)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1050120259)00111110100101111001000001000011

36 MD5 Generation Iteration 1: Step 29 a = d, d = c, c = b, b = previous resulting value a: (3225827088)11000000010001100011011100010000 b: (1050120259)00111110100101111001000001000011 c: (6120656)00000000010111010110010011010000 d: (687095634)00101000111101000011111101010010 Data Block: (0)00000000000000000000000000000000 R Constant: (5)00000000000000000000000000000101 Sin Value: (2850285829)10101001111000111110100100000101 Logic Function: (3225827088)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2542119733)10010111100001011010101100110101

37 MD5 Generation Iteration 1: Step 30 a = d, d = c, c = b, b = previous resulting value a: (687095634)00101000111101000011111101010010 b: (2542119733)10010111100001011010101100110101 c: (1050120259)00111110100101111001000001000011 d: (6120656)00000000010111010110010011010000 Data Block: (0)00000000000000000000000000000000 R Constant: (9)00000000000000000000000000001001 Sin Value: (4243563512)11111100111011111010001111111000 Logic Function: (687095634)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1856792061)01101110101011000110010111111101

38 MD5 Generation Iteration 1: Step 31 a = d, d = c, c = b, b = previous resulting value a: (6120656)00000000010111010110010011010000 b: (1856792061)01101110101011000110010111111101 c: (2542119733)10010111100001011010101100110101 d: (1050120259)00111110100101111001000001000011 Data Block: (0)00000000000000000000000000000000 R Constant: (14)00000000000000000000000000001110 Sin Value: (1735328473)01100111011011110000001011011001 Logic Function: (6120656)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (2473847761)10010011011100111110101111010001

39 MD5 Generation Iteration 1: Step 32 a = d, d = c, c = b, b = previous resulting value a: (1050120259)00111110100101111001000001000011 b: (2473847761)10010011011100111110101111010001 c: (1856792061)01101110101011000110010111111101 d: (2542119733)10010111100001011010101100110101 Data Block: (0)00000000000000000000000000000000 R Constant: (20)00000000000000000000000000010100 Sin Value: (2368359562)10001101001010100100110010001010 Logic Function: (1050120259)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: (1574984333)01011101111000000101101010001101

40 MD5 Generation Iteration 1: Step 33 a = d, d = c, c = b, b = previous resulting value a: (2542119733)10010111100001011010101100110101 b: (1574984333)01011101111000000101101010001101 c: (2473847761)10010011011100111110101111010001 d: (1856792061)01101110101011000110010111111101 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (4294588738)11111111111110100011100101000010 Logic Function: (2542119733)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3655068688)11011001110110111110110000010000

41 MD5 Generation Iteration 1: Step 34 a = d, d = c, c = b, b = previous resulting value a: (1856792061)01101110101011000110010111111101 b: (3655068688)11011001110110111110110000010000 c: (1574984333)01011101111000000101101010001101 d: (2473847761)10010011011100111110101111010001 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (2272392833)10000111011100011111011010000001 Logic Function: (1856792061)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (262814843)00001111101010100011110001111011

42 MD5 Generation Iteration 1: Step 35 a = d, d = c, c = b, b = previous resulting value a: (2473847761)10010011011100111110101111010001 b: (262814843)00001111101010100011110001111011 c: (3655068688)11011001110110111110110000010000 d: (1574984333)01011101111000000101101010001101 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (1839030562)01101101100111010110000100100010 Logic Function: (2473847761)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3884173597)11100111100000111100100100011101

43 MD5 Generation Iteration 1: Step 36 a = d, d = c, c = b, b = previous resulting value a: (1574984333)01011101111000000101101010001101 b: (3884173597)11100111100000111100100100011101 c: (262814843)00001111101010100011110001111011 d: (3655068688)11011001110110111110110000010000 Data Block: (48)00000000000000000000000000110000 R Constant: (23)00000000000000000000000000010111 Sin Value: (4259657740)11111101111001010011100000001100 Logic Function: (1574984333)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (122332403)00000111010010101010010011110011

44 MD5 Generation Iteration 1: Step 37 a = d, d = c, c = b, b = previous resulting value a: (3655068688)11011001110110111110110000010000 b: (122332403)00000111010010101010010011110011 c: (3884173597)11100111100000111100100100011101 d: (262814843)00001111101010100011110001111011 Data Block: (8414820)00000000100000000110011001100100 R Constant: (4)00000000000000000000000000000100 Sin Value: (2763975236)10100100101111101110101001000100 Logic Function: (3655068688)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (4013132233)11101111001100111000100111001001

45 MD5 Generation Iteration 1: Step 38 a = d, d = c, c = b, b = previous resulting value a: (262814843)00001111101010100011110001111011 b: (4013132233)11101111001100111000100111001001 c: (122332403)00000111010010101010010011110011 d: (3884173597)11100111100000111100100100011101 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (1272893353)01001011110111101100111110101001 Logic Function: (262814843)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (246801701)00001110101101011110010100100101

46 MD5 Generation Iteration 1: Step 39 a = d, d = c, c = b, b = previous resulting value a: (3884173597)11100111100000111100100100011101 b: (246801701)00001110101101011110010100100101 c: (4013132233)11101111001100111000100111001001 d: (122332403)00000111010010101010010011110011 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (4139469664)11110110101110110100101101100000 Logic Function: (3884173597)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3948063280)11101011010100101010101000110000

47 MD5 Generation Iteration 1: Step 40 a = d, d = c, c = b, b = previous resulting value a: (122332403)00000111010010101010010011110011 b: (3948063280)11101011010100101010101000110000 c: (246801701)00001110101101011110010100100101 d: (4013132233)11101111001100111000100111001001 Data Block: (0)00000000000000000000000000000000 R Constant: (23)00000000000000000000000000010111 Sin Value: (3200236656)10111110101111111011110001110000 Logic Function: (122332403)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (188422596)00001011001110110001100111000100

48 MD5 Generation Iteration 1: Step 41 a = d, d = c, c = b, b = previous resulting value a: (4013132233)11101111001100111000100111001001 b: (188422596)00001011001110110001100111000100 c: (3948063280)11101011010100101010101000110000 d: (246801701)00001110101101011110010100100101 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (681279174)00101000100110110111111011000110 Logic Function: (4013132233)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1978732484)01110101111100010000111111000100

49 MD5 Generation Iteration 1: Step 42 a = d, d = c, c = b, b = previous resulting value a: (246801701)00001110101101011110010100100101 b: (1978732484)01110101111100010000111111000100 c: (188422596)00001011001110110001100111000100 d: (3948063280)11101011010100101010101000110000 Data Block: (1936090209)01110011011001100110010001100001 R Constant: (11)00000000000000000000000000001011 Sin Value: (3936430074)11101010101000010010011111111010 Logic Function: (246801701)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (660508630)00100111010111101000111111010110

50 MD5 Generation Iteration 1: Step 43 a = d, d = c, c = b, b = previous resulting value a: (3948063280)11101011010100101010101000110000 b: (660508630)00100111010111101000111111010110 c: (1978732484)01110101111100010000111111000100 d: (188422596)00001011001110110001100111000100 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (3572445317)11010100111011110011000010000101 Logic Function: (3948063280)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (2615781804)10011011111010011010100110101100

51 MD5 Generation Iteration 1: Step 44 a = d, d = c, c = b, b = previous resulting value a: (188422596)00001011001110110001100111000100 b: (2615781804)10011011111010011010100110101100 c: (660508630)00100111010111101000111111010110 d: (1978732484)01110101111100010000111111000100 Data Block: (0)00000000000000000000000000000000 R Constant: (23)00000000000000000000000000010111 Sin Value: (76029189)00000100100010000001110100000101 Logic Function: (188422596)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3755355740)11011111110101100010111001011100

52 MD5 Generation Iteration 1: Step 45 a = d, d = c, c = b, b = previous resulting value a: (1978732484)01110101111100010000111111000100 b: (3755355740)11011111110101100010111001011100 c: (2615781804)10011011111010011010100110101100 d: (660508630)00100111010111101000111111010110 Data Block: (0)00000000000000000000000000000000 R Constant: (4)00000000000000000000000000000100 Sin Value: (3654602809)11011001110101001101000000111001 Logic Function: (1978732484)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (306491543)00010010010001001011000010010111

53 MD5 Generation Iteration 1: Step 46 a = d, d = c, c = b, b = previous resulting value a: (660508630)00100111010111101000111111010110 b: (306491543)00010010010001001011000010010111 c: (3755355740)11011111110101100010111001011100 d: (2615781804)10011011111010011010100110101100 Data Block: (0)00000000000000000000000000000000 R Constant: (11)00000000000000000000000000001011 Sin Value: (3873151461)11100110110110111001100111100101 Logic Function: (660508630)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (3175990204)10111101010011011100001110111100

54 MD5 Generation Iteration 1: Step 47 a = d, d = c, c = b, b = previous resulting value a: (2615781804)10011011111010011010100110101100 b: (3175990204)10111101010011011100001110111100 c: (306491543)00010010010001001011000010010111 d: (3755355740)11011111110101100010111001011100 Data Block: (0)00000000000000000000000000000000 R Constant: (16)00000000000000000000000000010000 Sin Value: (530742520)00011111101000100111110011111000 Logic Function: (2615781804)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (1097396263)01000001011010001111000000100111

55 MD5 Generation Iteration 1: Step 48 a = d, d = c, c = b, b = previous resulting value a: (3755355740)11011111110101100010111001011100 b: (1097396263)01000001011010001111000000100111 c: (3175990204)10111101010011011100001110111100 d: (306491543)00010010010001001011000010010111 Data Block: (0)00000000000000000000000000000000 R Constant: (23)00000000000000000000000000010111 Sin Value: (3299628645)11000100101011000101011001100101 Logic Function: (3755355740)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: (674390570)00101000001100100110001000101010

56 MD5 Generation Iteration 1: Step 49 a = d, d = c, c = b, b = previous resulting value a: (306491543)00010010010001001011000010010111 b: (674390570)00101000001100100110001000101010 c: (1097396263)01000001011010001111000000100111 d: (3175990204)10111101010011011100001110111100 Data Block: (1936090209)01110011011001100110010001100001 R Constant: (6)00000000000000000000000000000110 Sin Value: (4096336452)11110100001010010010001001000100 Logic Function: (306491543)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2481177683)10010011111000111100010001010011

57 MD5 Generation Iteration 1: Step 50 a = d, d = c, c = b, b = previous resulting value a: (3175990204)10111101010011011100001110111100 b: (2481177683)10010011111000111100010001010011 c: (674390570)00101000001100100110001000101010 d: (1097396263)01000001011010001111000000100111 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (1126891415)01000011001010101111111110010111 Logic Function: (3175990204)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (2376652467)10001101101010001101011010110011

58 MD5 Generation Iteration 1: Step 51 a = d, d = c, c = b, b = previous resulting value a: (1097396263)01000001011010001111000000100111 b: (2376652467)10001101101010001101011010110011 c: (2481177683)10010011111000111100010001010011 d: (674390570)00101000001100100110001000101010 Data Block: (48)00000000000000000000000000110000 R Constant: (15)00000000000000000000000000001111 Sin Value: (2878612391)10101011100101000010001110100111 Logic Function: (1097396263)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (628749112)00100101011110011111001100111000

59 MD5 Generation Iteration 1: Step 52 a = d, d = c, c = b, b = previous resulting value a: (674390570)00101000001100100110001000101010 b: (628749112)00100101011110011111001100111000 c: (2376652467)10001101101010001101011010110011 d: (2481177683)10010011111000111100010001010011 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (4237533241)11111100100100111010000000111001 Logic Function: (674390570)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (330999453)00010011101110101010011010011101

60 MD5 Generation Iteration 1: Step 53 a = d, d = c, c = b, b = previous resulting value a: (2481177683)10010011111000111100010001010011 b: (330999453)00010011101110101010011010011101 c: (628749112)00100101011110011111001100111000 d: (2376652467)10001101101010001101011010110011 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (1700485571)01100101010110110101100111000011 Logic Function: (2481177683)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (85550448)00000101000110010110010101110000

61 MD5 Generation Iteration 1: Step 54 a = d, d = c, c = b, b = previous resulting value a: (2376652467)10001101101010001101011010110011 b: (85550448)00000101000110010110010101110000 c: (330999453)00010011101110101010011010011101 d: (628749112)00100101011110011111001100111000 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (2399980690)10001111000011001100110010010010 Logic Function: (2376652467)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1926505747)01110010110101000010010100010011

62 MD5 Generation Iteration 1: Step 55 a = d, d = c, c = b, b = previous resulting value a: (628749112)00100101011110011111001100111000 b: (1926505747)01110010110101000010010100010011 c: (85550448)00000101000110010110010101110000 d: (330999453)00010011101110101010011010011101 Data Block: (0)00000000000000000000000000000000 R Constant: (15)00000000000000000000000000001111 Sin Value: (4293915773)11111111111011111111010001111101 Logic Function: (628749112)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1924150701)01110010101100000011010110101101

63 MD5 Generation Iteration 1: Step 56 a = d, d = c, c = b, b = previous resulting value a: (330999453)00010011101110101010011010011101 b: (1924150701)01110010101100000011010110101101 c: (1926505747)01110010110101000010010100010011 d: (85550448)00000101000110010110010101110000 Data Block: (8414820)00000000100000000110011001100100 R Constant: (21)00000000000000000000000000010101 Sin Value: (2240044497)10000101100001000101110111010001 Logic Function: (330999453)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (611611117)00100100011101000111000111101101

64 MD5 Generation Iteration 1: Step 57 a = d, d = c, c = b, b = previous resulting value a: (85550448)00000101000110010110010101110000 b: (611611117)00100100011101000111000111101101 c: (1924150701)01110010101100000011010110101101 d: (1926505747)01110010110101000010010100010011 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (1873313359)01101111101010000111111001001111 Logic Function: (85550448)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1222701506)01001000111000001111000111000010

65 MD5 Generation Iteration 1: Step 58 a = d, d = c, c = b, b = previous resulting value a: (1926505747)01110010110101000010010100010011 b: (1222701506)01001000111000001111000111000010 c: (611611117)00100100011101000111000111101101 d: (1924150701)01110010101100000011010110101101 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (4264355552)11111110001011001110011011100000 Logic Function: (1926505747)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (3141122860)10111011001110011011101100101100

66 MD5 Generation Iteration 1: Step 59 a = d, d = c, c = b, b = previous resulting value a: (1924150701)01110010101100000011010110101101 b: (3141122860)10111011001110011011101100101100 c: (1222701506)01001000111000001111000111000010 d: (611611117)00100100011101000111000111101101 Data Block: (0)00000000000000000000000000000000 R Constant: (15)00000000000000000000000000001111 Sin Value: (2734768916)10100011000000010100001100010100 Logic Function: (1924150701)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (521707442)00011111000110001001111110110010

67 MD5 Generation Iteration 1: Step 60 a = d, d = c, c = b, b = previous resulting value a: (611611117)00100100011101000111000111101101 b: (521707442)00011111000110001001111110110010 c: (3141122860)10111011001110011011101100101100 d: (1222701506)01001000111000001111000111000010 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (1309151649)01001110000010000001000110100001 Logic Function: (611611117)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (591885319)00100011010001110111010000000111

68 MD5 Generation Iteration 1: Step 61 a = d, d = c, c = b, b = previous resulting value a: (1222701506)01001000111000001111000111000010 b: (591885319)00100011010001110111010000000111 c: (521707442)00011111000110001001111110110010 d: (3141122860)10111011001110011011101100101100 Data Block: (0)00000000000000000000000000000000 R Constant: (6)00000000000000000000000000000110 Sin Value: (4149444226)11110111010100110111111010000010 Logic Function: (1222701506)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (1751015029)01101000010111100101111001110101

69 MD5 Generation Iteration 1: Step 62 a = d, d = c, c = b, b = previous resulting value a: (3141122860)10111011001110011011101100101100 b: (1751015029)01101000010111100101111001110101 c: (591885319)00100011010001110111010000000111 d: (521707442)00011111000110001001111110110010 Data Block: (0)00000000000000000000000000000000 R Constant: (10)00000000000000000000000000001010 Sin Value: (3174756917)10111101001110101111001000110101 Logic Function: (3141122860)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (457034629)00011011001111011100101110000101

70 MD5 Generation Iteration 1: Step 63 a = d, d = c, c = b, b = previous resulting value a: (521707442)00011111000110001001111110110010 b: (457034629)00011011001111011100101110000101 c: (1751015029)01101000010111100101111001110101 d: (591885319)00100011010001110111010000000111 Data Block: (0)00000000000000000000000000000000 R Constant: (15)00000000000000000000000000001111 Sin Value: (718787259)00101010110101111101001010111011 Logic Function: (521707442)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (523783279)00011111001110000100110001101111

71 MD5 Generation Iteration 1: Step 64 a = d, d = c, c = b, b = previous resulting value a: (591885319)00100011010001110111010000000111 b: (523783279)00011111001110000100110001101111 c: (457034629)00011011001111011100101110000101 d: (1751015029)01101000010111100101111001110101 Data Block: (0)00000000000000000000000000000000 R Constant: (21)00000000000000000000000000010101 Sin Value: (3951481745)11101011100001101101001110010001 Logic Function: (591885319)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: (3750409916)11011111100010101011011010111100

72 MD5 Generation After Iteration 1: Add the new result to the previous iteration's result h0 + A: 3483599222 h1 + B: 3478676037 h2 + C: 3086166381 h3 + D: 728768507

73 MD5 Generation After all iterations are complete h0: 3483599222 (Hex: 7681a3cf) h1: 3478676037 (Hex: 456258cf) h2: 3086166381 (Hex: 6d29f3b7) h3: 728768507 (Hex: fb1f702b) The final digest: 7681a3cf456258cf6d29f3b7fb1f702b

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