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 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 := 0x var int h1 := 0xEFCDAB89 var int h2 := 0x98BADCFE var int h3 := 0x Pre-processing the data is as follows: 1) Convert the data to a byte array 2) Append '1' bit to the data 3) Append '0' bits until message length in bits is 64 bits short of being a perfect multiple of 512 4) Append bit length of unpadded message as 64- bit little-endian integer to message The pre-processing of the data is done. Now we just run the data through the functions.

4 MD5 Pseudo code For each 512-bit chunk of message break chunk into sixteen 32-bit little-endian words w[i] for(i=0;i<15;i++) /* Initialize hash value for this chunk: (recall h0,h1,h2,h3 were declared as constants earlier) */ var int a := h0 var int b := h1 var int c := h2 var int d := h3 /* Main loop: */ /* Here are the logic functions that define this algorithm */ for i from 0 to 63 if 0 ≤ i ≤ 15 then f := (b and c) or ((not b) and d) g := i else if 16 ≤ i ≤ 31 f := (d and b) or ((not d) and c) g := (5×i + 1) mod 16 else if 32 ≤ i ≤ 47 f := b xor c xor d g := (3×i + 5) mod 16 else if 48 ≤ i ≤ 63 f := c xor (b or (not d)) g := (7×i) mod 16 temp := d d := c c := b b := b + leftrotate((a + f + k[i] + w[g]), r[i]) a := temp h0 := h0 + a h1 := h1 + b h2 := h2 + c h3 := h3 + d After all rounds are complete, the message digest is h0 append h1 append h2 append h3

5 MD5 Generation From User Input User Input String: 'asdasdadadasdasdas' User Input Bytes:

6 MD5 Generation From User Input After Pre-Processing of data, Message Bytes: 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: h1: h2: h3:

8 MD5 Generation Iteration 1: Step 1 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (7) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

9 MD5 Generation Iteration 1: Step 2 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (12) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

10 MD5 Generation Iteration 1: Step 3 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (17) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

11 MD5 Generation Iteration 1: Step 4 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (22) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

12 MD5 Generation Iteration 1: Step 5 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (7) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

13 MD5 Generation Iteration 1: Step 6 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (12) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

14 MD5 Generation Iteration 1: Step 7 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (17) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

15 MD5 Generation Iteration 1: Step 8 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (22) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

16 MD5 Generation Iteration 1: Step 9 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (7) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

17 MD5 Generation Iteration 1: Step 10 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (12) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

18 MD5 Generation Iteration 1: Step 11 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (17) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

19 MD5 Generation Iteration 1: Step 12 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (22) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

20 MD5 Generation Iteration 1: Step 13 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (7) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

21 MD5 Generation Iteration 1: Step 14 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (12) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

22 MD5 Generation Iteration 1: Step 15 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (144) R Constant: (17) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

23 MD5 Generation Iteration 1: Step 16 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (22) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

24 MD5 Generation Iteration 1: Step 17 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (5) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

25 MD5 Generation Iteration 1: Step 18 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (9) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

26 MD5 Generation Iteration 1: Step 19 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (14) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

27 MD5 Generation Iteration 1: Step 20 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (20) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

28 MD5 Generation Iteration 1: Step 21 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (5) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

29 MD5 Generation Iteration 1: Step 22 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (9) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

30 MD5 Generation Iteration 1: Step 23 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (14) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

31 MD5 Generation Iteration 1: Step 24 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (20) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

32 MD5 Generation Iteration 1: Step 25 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (5) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

33 MD5 Generation Iteration 1: Step 26 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (144) R Constant: (9) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

34 MD5 Generation Iteration 1: Step 27 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (14) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

35 MD5 Generation Iteration 1: Step 28 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (20) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

36 MD5 Generation Iteration 1: Step 29 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (5) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

37 MD5 Generation Iteration 1: Step 30 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (9) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

38 MD5 Generation Iteration 1: Step 31 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (14) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

39 MD5 Generation Iteration 1: Step 32 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (20) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant) Result after shifting: ( )

40 MD5 Generation Iteration 1: Step 33 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (4) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

41 MD5 Generation Iteration 1: Step 34 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (11) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

42 MD5 Generation Iteration 1: Step 35 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (16) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

43 MD5 Generation Iteration 1: Step 36 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (144) R Constant: (23) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

44 MD5 Generation Iteration 1: Step 37 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (4) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

45 MD5 Generation Iteration 1: Step 38 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (11) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

46 MD5 Generation Iteration 1: Step 39 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (16) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

47 MD5 Generation Iteration 1: Step 40 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (23) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

48 MD5 Generation Iteration 1: Step 41 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (4) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

49 MD5 Generation Iteration 1: Step 42 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (11) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

50 MD5 Generation Iteration 1: Step 43 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (16) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

51 MD5 Generation Iteration 1: Step 44 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (23) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

52 MD5 Generation Iteration 1: Step 45 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (4) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

53 MD5 Generation Iteration 1: Step 46 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (11) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

54 MD5 Generation Iteration 1: Step 47 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (16) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

55 MD5 Generation Iteration 1: Step 48 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (23) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant) Result after shifting: ( )

56 MD5 Generation Iteration 1: Step 49 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (6) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

57 MD5 Generation Iteration 1: Step 50 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (10) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

58 MD5 Generation Iteration 1: Step 51 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (144) R Constant: (15) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

59 MD5 Generation Iteration 1: Step 52 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (21) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

60 MD5 Generation Iteration 1: Step 53 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (6) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

61 MD5 Generation Iteration 1: Step 54 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (10) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

62 MD5 Generation Iteration 1: Step 55 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (15) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

63 MD5 Generation Iteration 1: Step 56 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (21) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

64 MD5 Generation Iteration 1: Step 57 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (6) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

65 MD5 Generation Iteration 1: Step 58 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (10) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

66 MD5 Generation Iteration 1: Step 59 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (15) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

67 MD5 Generation Iteration 1: Step 60 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (21) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

68 MD5 Generation Iteration 1: Step 61 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (6) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

69 MD5 Generation Iteration 1: Step 62 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (10) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

70 MD5 Generation Iteration 1: Step 63 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: ( ) R Constant: (15) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

71 MD5 Generation Iteration 1: Step 64 a = d, d = c, c = b, b = previous resulting value a: ( ) b: ( ) c: ( ) d: ( ) Data Block: (0) R Constant: (21) Sin Value: ( ) Logic Function: ( )int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant) Result after shifting: ( )

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

73 MD5 Generation After all iterations are complete h0: (Hex: 8ce2480f) h1: (Hex: 2cae651f) h2: (Hex: 9d5a0143) h3: (Hex: 4b1fcf95) The final digest: 8ce2480f2cae651f9d5a01434b1fcf95

74 MD5 Generation Summary As you can see, there is quite a bit of bit shifting happening which makes it nearly impossible to reverse engineer The goal of generating hash keys (i.e. Message Digests) is exactly this- to ensure data integrity. Hopefully this presentation has helped you gain a better understanding of how the process of key generation works.

75


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

Similar presentations


Ads by Google