Upload
catherine-blackwell
View
58
Download
1
Embed Size (px)
DESCRIPTION
MD5 Generation. Auto-Generated Slides To Visualize MD5 Hash Generation by Chris Fremgen. 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. - PowerPoint PPT Presentation
Citation preview
MD5 Generation
Auto-Generated Slides To Visualize MD5 Hash Generation by Chris
Fremgen
MD5 Hashing SummaryMD5 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.
MD5 Data PreprocessingPreprocessing: 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.
MD5 Pseudo codeFor 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
MD5 Generation From User Input
User Input String: 'czvbbcvbz'User Input Bytes: 99 122 118 98 98 99 118 98 122
MD5 Generation From User InputAfter Pre-Processing of data, Message Bytes: 99 122
118 98 98 99 118 98 122 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 72 0 0 0 0 0 0 0
There will be 1 iteration(s) since the padded message size is 512 bits long
MD5 GenerationNow 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: 1732584193h1: 4023233417h2: 2562383102h3: 271733878
MD5 Generation Iteration 1: Step 1a = d, d = c, c = b, b = previous resulting value
a: (1732584193)01100111010001010010001100000001b: (4023233417)11101111110011011010101110001001c: (2562383102)10011000101110101101110011111110d: (271733878)00010000001100100101010001110110
Data Block: (1651931747)01100010011101100111101001100011R Constant: (7)00000000000000000000000000000111Sin Value: (3614090360)11010111011010101010010001111000
Logic Function: (1732584193)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (3764197541)11100000010111010001100010100101
MD5 Generation Iteration 1: Step 2a = d, d = c, c = b, b = previous resulting value
a: (271733878)00010000001100100101010001110110b: (3764197541)11100000010111010001100010100101c: (4023233417)11101111110011011010101110001001d: (2562383102)10011000101110101101110011111110
Data Block: (1651925858)01100010011101100110001101100010R Constant: (12)00000000000000000000000000001100Sin Value: (3905402710)11101000110001111011011101010110
Logic Function: (271733878)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (3827150315)11100100000111011010110111101011
MD5 Generation Iteration 1: Step 3a = d, d = c, c = b, b = previous resulting value
a: (2562383102)10011000101110101101110011111110b: (3827150315)11100100000111011010110111101011c: (3764197541)11100000010111010001100010100101d: (4023233417)11101111110011011010101110001001
Data Block: (32890)00000000000000001000000001111010R Constant: (17)00000000000000000000000000010001Sin Value: (606105819)00100100001000000111000011011011
Logic Function: (2562383102)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (2517040988)10010110000001101111111101011100
MD5 Generation Iteration 1: Step 4a = d, d = c, c = b, b = previous resulting value
a: (4023233417)11101111110011011010101110001001b: (2517040988)10010110000001101111111101011100c: (3827150315)11100100000111011010110111101011d: (3764197541)11100000010111010001100010100101
Data Block: (0)00000000000000000000000000000000R Constant: (22)00000000000000000000000000010110Sin Value: (3250441966)11000001101111011100111011101110
Logic Function: (4023233417)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (2922150310)10101110001011000111100110100110
MD5 Generation Iteration 1: Step 5a = d, d = c, c = b, b = previous resulting value
a: (3764197541)11100000010111010001100010100101b: (2922150310)10101110001011000111100110100110c: (2517040988)10010110000001101111111101011100d: (3827150315)11100100000111011010110111101011
Data Block: (0)00000000000000000000000000000000R Constant: (7)00000000000000000000000000000111Sin Value: (4118548399)11110101011111000000111110101111
Logic Function: (3764197541)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (2780777075)10100101101111110100101001110011
MD5 Generation Iteration 1: Step 6a = d, d = c, c = b, b = previous resulting value
a: (3827150315)11100100000111011010110111101011b: (2780777075)10100101101111110100101001110011c: (2922150310)10101110001011000111100110100110d: (2517040988)10010110000001101111111101011100
Data Block: (0)00000000000000000000000000000000R Constant: (12)00000000000000000000000000001100Sin Value: (1200080426)01000111100001111100011000101010
Logic Function: (3827150315)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (3436415120)11001100110100111000100010010000
MD5 Generation Iteration 1: Step 7a = d, d = c, c = b, b = previous resulting value
a: (2517040988)10010110000001101111111101011100b: (3436415120)11001100110100111000100010010000c: (2780777075)10100101101111110100101001110011d: (2922150310)10101110001011000111100110100110
Data Block: (0)00000000000000000000000000000000R Constant: (17)00000000000000000000000000010001Sin Value: (2821735955)10101000001100000100011000010011
Logic Function: (2517040988)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (1243566717)01001010000111110101001001111101
MD5 Generation Iteration 1: Step 8a = d, d = c, c = b, b = previous resulting value
a: (2922150310)10101110001011000111100110100110b: (1243566717)01001010000111110101001001111101c: (3436415120)11001100110100111000100010010000d: (2780777075)10100101101111110100101001110011
Data Block: (0)00000000000000000000000000000000R Constant: (22)00000000000000000000000000010110Sin Value: (4249261313)11111101010001101001010100000001
Logic Function: (2922150310)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (4169505794)11111000100001011001110000000010
MD5 Generation Iteration 1: Step 9a = d, d = c, c = b, b = previous resulting value
a: (2780777075)10100101101111110100101001110011b: (4169505794)11111000100001011001110000000010c: (1243566717)01001010000111110101001001111101d: (3436415120)11001100110100111000100010010000
Data Block: (0)00000000000000000000000000000000R Constant: (7)00000000000000000000000000000111Sin Value: (1770035416)01101001100000001001100011011000
Logic Function: (2780777075)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (3288304047)11000011111111111000100110101111
MD5 Generation Iteration 1: Step 10a = d, d = c, c = b, b = previous resulting value
a: (3436415120)11001100110100111000100010010000b: (3288304047)11000011111111111000100110101111c: (4169505794)11111000100001011001110000000010d: (1243566717)01001010000111110101001001111101
Data Block: (0)00000000000000000000000000000000R Constant: (12)00000000000000000000000000001100Sin Value: (2336552879)10001011010001001111011110101111
Logic Function: (3436415120)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (2846399416)10101001101010001001101110111000
MD5 Generation Iteration 1: Step 11a = d, d = c, c = b, b = previous resulting value
a: (1243566717)01001010000111110101001001111101b: (2846399416)10101001101010001001101110111000c: (3288304047)11000011111111111000100110101111d: (4169505794)11111000100001011001110000000010
Data Block: (0)00000000000000000000000000000000R Constant: (17)00000000000000000000000000010001Sin Value: (4294925233)11111111111111110101101110110001
Logic Function: (1243566717)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (559469392)00100001010110001101001101010000
MD5 Generation Iteration 1: Step 12a = d, d = c, c = b, b = previous resulting value
a: (4169505794)11111000100001011001110000000010b: (559469392)00100001010110001101001101010000c: (2846399416)10101001101010001001101110111000d: (3288304047)11000011111111111000100110101111
Data Block: (0)00000000000000000000000000000000R Constant: (22)00000000000000000000000000010110Sin Value: (2304563134)10001001010111001101011110111110
Logic Function: (4169505794)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (20068307)00000001001100100011011111010011
MD5 Generation Iteration 1: Step 13a = d, d = c, c = b, b = previous resulting value
a: (3288304047)11000011111111111000100110101111b: (20068307)00000001001100100011011111010011c: (559469392)00100001010110001101001101010000d: (2846399416)10101001101010001001101110111000
Data Block: (0)00000000000000000000000000000000R Constant: (7)00000000000000000000000000000111Sin Value: (1804603682)01101011100100000001000100100010
Logic Function: (3288304047)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (2504875199)10010101010011010101110010111111
MD5 Generation Iteration 1: Step 14a = d, d = c, c = b, b = previous resulting value
a: (2846399416)10101001101010001001101110111000b: (2504875199)10010101010011010101110010111111c: (20068307)00000001001100100011011111010011d: (559469392)00100001010110001101001101010000
Data Block: (0)00000000000000000000000000000000R Constant: (12)00000000000000000000000000001100Sin Value: (4254626195)11111101100110000111000110010011
Logic Function: (2846399416)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (2946451780)10101111100111110100100101000100
MD5 Generation Iteration 1: Step 15a = d, d = c, c = b, b = previous resulting value
a: (559469392)00100001010110001101001101010000b: (2946451780)10101111100111110100100101000100c: (2504875199)10010101010011010101110010111111d: (20068307)00000001001100100011011111010011
Data Block: (72)00000000000000000000000001001000R Constant: (17)00000000000000000000000000010001Sin Value: (2792965006)10100110011110010100001110001110
Logic Function: (559469392)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (3675906883)11011011000110011110001101000011
MD5 Generation Iteration 1: Step 16a = d, d = c, c = b, b = previous resulting value
a: (20068307)00000001001100100011011111010011b: (3675906883)11011011000110011110001101000011c: (2946451780)10101111100111110100100101000100d: (2504875199)10010101010011010101110010111111
Data Block: (0)00000000000000000000000000000000R Constant: (22)00000000000000000000000000010110Sin Value: (1236535329)01001001101101000000100000100001
Logic Function: (20068307)int result = b + RotateLeft((a +(b & c) | (~b & d)) + DataBlock + SinValue), R Constant)
Result after shifting: (1464890410)01010111010100000111010000101010
MD5 Generation Iteration 1: Step 17a = d, d = c, c = b, b = previous resulting value
a: (2504875199)10010101010011010101110010111111b: (1464890410)01010111010100000111010000101010c: (3675906883)11011011000110011110001101000011d: (2946451780)10101111100111110100100101000100
Data Block: (1651925858)01100010011101100110001101100010R Constant: (5)00000000000000000000000000000101Sin Value: (4129170786)11110110000111100010010101100010
Logic Function: (2504875199)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (4121519346)11110101101010010110010011110010
MD5 Generation Iteration 1: Step 18a = d, d = c, c = b, b = previous resulting value
a: (2946451780)10101111100111110100100101000100b: (4121519346)11110101101010010110010011110010c: (1464890410)01010111010100000111010000101010d: (3675906883)11011011000110011110001101000011
Data Block: (0)00000000000000000000000000000000R Constant: (9)00000000000000000000000000001001Sin Value: (3225465664)11000000010000001011001101000000
Logic Function: (2946451780)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (1217085820)01001000100010110100000101111100
MD5 Generation Iteration 1: Step 19a = d, d = c, c = b, b = previous resulting value
a: (3675906883)11011011000110011110001101000011b: (1217085820)01001000100010110100000101111100c: (4121519346)11110101101010010110010011110010d: (1464890410)01010111010100000111010000101010
Data Block: (0)00000000000000000000000000000000R Constant: (14)00000000000000000000000000001110Sin Value: (643717713)00100110010111100101101001010001
Logic Function: (3675906883)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (2821618180)10101000001011100111101000000100
MD5 Generation Iteration 1: Step 20a = d, d = c, c = b, b = previous resulting value
a: (1464890410)01010111010100000111010000101010b: (2821618180)10101000001011100111101000000100c: (1217085820)01001000100010110100000101111100d: (4121519346)11110101101010010110010011110010
Data Block: (1651931747)01100010011101100111101001100011R Constant: (20)00000000000000000000000000010100Sin Value: (3921069994)11101001101101101100011110101010
Logic Function: (1464890410)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (476263557)00011100011000110011010010000101
MD5 Generation Iteration 1: Step 21a = d, d = c, c = b, b = previous resulting value
a: (4121519346)11110101101010010110010011110010b: (476263557)00011100011000110011010010000101c: (2821618180)10101000001011100111101000000100d: (1217085820)01001000100010110100000101111100
Data Block: (0)00000000000000000000000000000000R Constant: (5)00000000000000000000000000000101Sin Value: (3593408605)11010110001011110001000001011101
Logic Function: (4121519346)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (2623086323)10011100010110010001111011110011
MD5 Generation Iteration 1: Step 22a = d, d = c, c = b, b = previous resulting value
a: (1217085820)01001000100010110100000101111100b: (2623086323)10011100010110010001111011110011c: (476263557)00011100011000110011010010000101d: (2821618180)10101000001011100111101000000100
Data Block: (0)00000000000000000000000000000000R Constant: (9)00000000000000000000000000001001Sin Value: (38016083)00000010010001000001010001010011
Logic Function: (1217085820)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (3443638465)11001101010000011100000011000001
MD5 Generation Iteration 1: Step 23a = d, d = c, c = b, b = previous resulting value
a: (2821618180)10101000001011100111101000000100b: (3443638465)11001101010000011100000011000001c: (2623086323)10011100010110010001111011110011d: (476263557)00011100011000110011010010000101
Data Block: (0)00000000000000000000000000000000R Constant: (14)00000000000000000000000000001110Sin Value: (3634488961)11011000101000011110011010000001
Logic Function: (2821618180)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (673170443)00101000000111111100010000001011
MD5 Generation Iteration 1: Step 24a = d, d = c, c = b, b = previous resulting value
a: (476263557)00011100011000110011010010000101b: (673170443)00101000000111111100010000001011c: (3443638465)11001101010000011100000011000001d: (2623086323)10011100010110010001111011110011
Data Block: (0)00000000000000000000000000000000R Constant: (20)00000000000000000000000000010100Sin Value: (3889429448)11100111110100111111101111001000
Logic Function: (476263557)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (1831115034)01101101001001001001100100011010
MD5 Generation Iteration 1: Step 25a = d, d = c, c = b, b = previous resulting value
a: (2623086323)10011100010110010001111011110011b: (1831115034)01101101001001001001100100011010c: (673170443)00101000000111111100010000001011d: (3443638465)11001101010000011100000011000001
Data Block: (0)00000000000000000000000000000000R Constant: (5)00000000000000000000000000000101Sin Value: (568446438)00100001111000011100110111100110
Logic Function: (2623086323)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (3629299071)11011000010100101011010101111111
MD5 Generation Iteration 1: Step 26a = d, d = c, c = b, b = previous resulting value
a: (3443638465)11001101010000011100000011000001b: (3629299071)11011000010100101011010101111111c: (1831115034)01101101001001001001100100011010d: (673170443)00101000000111111100010000001011
Data Block: (72)00000000000000000000000001001000R Constant: (9)00000000000000000000000000001001Sin Value: (3275163606)11000011001101110000011111010110
Logic Function: (3443638465)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (790539066)00101111000111101010101100111010
MD5 Generation Iteration 1: Step 27a = d, d = c, c = b, b = previous resulting value
a: (673170443)00101000000111111100010000001011b: (790539066)00101111000111101010101100111010c: (3629299071)11011000010100101011010101111111d: (1831115034)01101101001001001001100100011010
Data Block: (0)00000000000000000000000000000000R Constant: (14)00000000000000000000000000001110Sin Value: (4107603335)11110100110101010000110110000111
Logic Function: (673170443)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (249766348)00001110111000110010000111001100
MD5 Generation Iteration 1: Step 28a = d, d = c, c = b, b = previous resulting value
a: (1831115034)01101101001001001001100100011010b: (249766348)00001110111000110010000111001100c: (790539066)00101111000111101010101100111010d: (3629299071)11011000010100101011010101111111
Data Block: (0)00000000000000000000000000000000R Constant: (20)00000000000000000000000000010100Sin Value: (1163531501)01000101010110100001010011101101
Logic Function: (1831115034)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (2753642137)10100100001000010011111010011001
MD5 Generation Iteration 1: Step 29a = d, d = c, c = b, b = previous resulting value
a: (3629299071)11011000010100101011010101111111b: (2753642137)10100100001000010011111010011001c: (249766348)00001110111000110010000111001100d: (790539066)00101111000111101010101100111010
Data Block: (0)00000000000000000000000000000000R Constant: (5)00000000000000000000000000000101Sin Value: (2850285829)10101001111000111110100100000101
Logic Function: (3629299071)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (2266655405)10000111000110100110101010101101
MD5 Generation Iteration 1: Step 30a = d, d = c, c = b, b = previous resulting value
a: (790539066)00101111000111101010101100111010b: (2266655405)10000111000110100110101010101101c: (2753642137)10100100001000010011111010011001d: (249766348)00001110111000110010000111001100
Data Block: (32890)00000000000000001000000001111010R Constant: (9)00000000000000000000000000001001Sin Value: (4243563512)11111100111011111010001111111000
Logic Function: (790539066)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (2838953553)10101001001101101111111001010001
MD5 Generation Iteration 1: Step 31a = d, d = c, c = b, b = previous resulting value
a: (249766348)00001110111000110010000111001100b: (2838953553)10101001001101101111111001010001c: (2266655405)10000111000110100110101010101101d: (2753642137)10100100001000010011111010011001
Data Block: (0)00000000000000000000000000000000R Constant: (14)00000000000000000000000000001110Sin Value: (1735328473)01100111011011110000001011011001
Logic Function: (249766348)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (3522004148)11010001111011011000010010110100
MD5 Generation Iteration 1: Step 32a = d, d = c, c = b, b = previous resulting value
a: (2753642137)10100100001000010011111010011001b: (3522004148)11010001111011011000010010110100c: (2838953553)10101001001101101111111001010001d: (2266655405)10000111000110100110101010101101
Data Block: (0)00000000000000000000000000000000R Constant: (20)00000000000000000000000000010100Sin Value: (2368359562)10001101001010100100110010001010
Logic Function: (2753642137)int result = b + RotateLeft((a + ((b & d) | (c & ~d)) + DataBlock + SinValue), R Constant)
Result after shifting: (3547016246)11010011011010110010110000110110
MD5 Generation Iteration 1: Step 33a = d, d = c, c = b, b = previous resulting value
a: (2266655405)10000111000110100110101010101101b: (3547016246)11010011011010110010110000110110c: (3522004148)11010001111011011000010010110100d: (2838953553)10101001001101101111111001010001
Data Block: (0)00000000000000000000000000000000R Constant: (4)00000000000000000000000000000100Sin Value: (4294588738)11111111111110100011100101000010
Logic Function: (2266655405)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (4290435161)11111111101110101101100001011001
MD5 Generation Iteration 1: Step 34a = d, d = c, c = b, b = previous resulting value
a: (2838953553)10101001001101101111111001010001b: (4290435161)11111111101110101101100001011001c: (3547016246)11010011011010110010110000110110d: (3522004148)11010001111011011000010010110100
Data Block: (0)00000000000000000000000000000000R Constant: (11)00000000000000000000000000001011Sin Value: (2272392833)10000111011100011111011010000001
Logic Function: (2838953553)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (719864264)00101010111010000100000111001000
MD5 Generation Iteration 1: Step 35a = d, d = c, c = b, b = previous resulting value
a: (3522004148)11010001111011011000010010110100b: (719864264)00101010111010000100000111001000c: (4290435161)11111111101110101101100001011001d: (3547016246)11010011011010110010110000110110
Data Block: (0)00000000000000000000000000000000R Constant: (16)00000000000000000000000000010000Sin Value: (1839030562)01101101100111010110000100100010
Logic Function: (3522004148)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (3328542604)11000110011001011000011110001100
MD5 Generation Iteration 1: Step 36a = d, d = c, c = b, b = previous resulting value
a: (3547016246)11010011011010110010110000110110b: (3328542604)11000110011001011000011110001100c: (719864264)00101010111010000100000111001000d: (4290435161)11111111101110101101100001011001
Data Block: (72)00000000000000000000000001001000R Constant: (23)00000000000000000000000000010111Sin Value: (4259657740)11111101111001010011100000001100
Logic Function: (3547016246)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (441961293)00011010010101111100101101001101
MD5 Generation Iteration 1: Step 37a = d, d = c, c = b, b = previous resulting value
a: (4290435161)11111111101110101101100001011001b: (441961293)00011010010101111100101101001101c: (3328542604)11000110011001011000011110001100d: (719864264)00101010111010000100000111001000
Data Block: (1651925858)01100010011101100110001101100010R Constant: (4)00000000000000000000000000000100Sin Value: (2763975236)10100100101111101110101001000100
Logic Function: (4290435161)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (4143643612)11110110111110101111101111011100
MD5 Generation Iteration 1: Step 38a = d, d = c, c = b, b = previous resulting value
a: (719864264)00101010111010000100000111001000b: (4143643612)11110110111110101111101111011100c: (441961293)00011010010101111100101101001101d: (3328542604)11000110011001011000011110001100
Data Block: (0)00000000000000000000000000000000R Constant: (11)00000000000000000000000000001011Sin Value: (1272893353)01001011110111101100111110101001
Logic Function: (719864264)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (1967091944)01110101001111110111000011101000
MD5 Generation Iteration 1: Step 39a = d, d = c, c = b, b = previous resulting value
a: (3328542604)11000110011001011000011110001100b: (1967091944)01110101001111110111000011101000c: (4143643612)11110110111110101111101111011100d: (441961293)00011010010101111100101101001101
Data Block: (0)00000000000000000000000000000000R Constant: (16)00000000000000000000000000010000Sin Value: (4139469664)11110110101110110100101101100000
Logic Function: (3328542604)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (2292500379)10001000101001001100011110011011
MD5 Generation Iteration 1: Step 40a = d, d = c, c = b, b = previous resulting value
a: (441961293)00011010010101111100101101001101b: (2292500379)10001000101001001100011110011011c: (1967091944)01110101001111110111000011101000d: (4143643612)11110110111110101111101111011100
Data Block: (0)00000000000000000000000000000000R Constant: (23)00000000000000000000000000010111Sin Value: (3200236656)10111110101111111011110001110000
Logic Function: (441961293)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (3205956613)10111111000101110000010000000101
MD5 Generation Iteration 1: Step 41a = d, d = c, c = b, b = previous resulting value
a: (4143643612)11110110111110101111101111011100b: (3205956613)10111111000101110000010000000101c: (2292500379)10001000101001001100011110011011d: (1967091944)01110101001111110111000011101000
Data Block: (0)00000000000000000000000000000000R Constant: (4)00000000000000000000000000000100Sin Value: (681279174)00101000100110110111111011000110
Logic Function: (4143643612)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (3779716491)11100001010010011110010110001011
MD5 Generation Iteration 1: Step 42a = d, d = c, c = b, b = previous resulting value
a: (1967091944)01110101001111110111000011101000b: (3779716491)11100001010010011110010110001011c: (3205956613)10111111000101110000010000000101d: (2292500379)10001000101001001100011110011011
Data Block: (1651931747)01100010011101100111101001100011R Constant: (11)00000000000000000000000000001011Sin Value: (3936430074)11101010101000010010011111111010
Logic Function: (1967091944)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (1796520533)01101011000101001011101001010101
MD5 Generation Iteration 1: Step 43a = d, d = c, c = b, b = previous resulting value
a: (2292500379)10001000101001001100011110011011b: (1796520533)01101011000101001011101001010101c: (3779716491)11100001010010011110010110001011d: (3205956613)10111111000101110000010000000101
Data Block: (0)00000000000000000000000000000000R Constant: (16)00000000000000000000000000010000Sin Value: (3572445317)11010100111011110011000010000101
Logic Function: (2292500379)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (3205516595)10111111000100000100110100110011
MD5 Generation Iteration 1: Step 44a = d, d = c, c = b, b = previous resulting value
a: (3205956613)10111111000101110000010000000101b: (3205516595)10111111000100000100110100110011c: (1796520533)01101011000101001011101001010101d: (3779716491)11100001010010011110010110001011
Data Block: (0)00000000000000000000000000000000R Constant: (23)00000000000000000000000000010111Sin Value: (76029189)00000100100010000001110100000101
Logic Function: (3205956613)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (3138175820)10111011000011001100001101001100
MD5 Generation Iteration 1: Step 45a = d, d = c, c = b, b = previous resulting value
a: (3779716491)11100001010010011110010110001011b: (3138175820)10111011000011001100001101001100c: (3205516595)10111111000100000100110100110011d: (1796520533)01101011000101001011101001010101
Data Block: (0)00000000000000000000000000000000R Constant: (4)00000000000000000000000000000100Sin Value: (3654602809)11011001110101001101000000111001
Logic Function: (3779716491)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (1568367150)01011101011110110110001000101110
MD5 Generation Iteration 1: Step 46a = d, d = c, c = b, b = previous resulting value
a: (1796520533)01101011000101001011101001010101b: (1568367150)01011101011110110110001000101110c: (3138175820)10111011000011001100001101001100d: (3205516595)10111111000100000100110100110011
Data Block: (0)00000000000000000000000000000000R Constant: (11)00000000000000000000000000001011Sin Value: (3873151461)11100110110110111001100111100101
Logic Function: (1796520533)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (528465800)00011111011111111011111110001000
MD5 Generation Iteration 1: Step 47a = d, d = c, c = b, b = previous resulting value
a: (3205516595)10111111000100000100110100110011b: (528465800)00011111011111111011111110001000c: (1568367150)01011101011110110110001000101110d: (3138175820)10111011000011001100001101001100
Data Block: (0)00000000000000000000000000000000R Constant: (16)00000000000000000000000000010000Sin Value: (530742520)00011111101000100111110011111000
Logic Function: (3205516595)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (144021314)00001000100101011001011101000010
MD5 Generation Iteration 1: Step 48a = d, d = c, c = b, b = previous resulting value
a: (3138175820)10111011000011001100001101001100b: (144021314)00001000100101011001011101000010c: (528465800)00011111011111111011111110001000d: (1568367150)01011101011110110110001000101110
Data Block: (32890)00000000000000001000000001111010R Constant: (23)00000000000000000000000000010111Sin Value: (3299628645)11000100101011000101011001100101
Logic Function: (3138175820)int result = b + RotateLeft((a + (b ^ c ^ d) + DataBlock + SinValue), R Constant)
Result after shifting: (2423962804)10010000011110101011110010110100
MD5 Generation Iteration 1: Step 49a = d, d = c, c = b, b = previous resulting value
a: (1568367150)01011101011110110110001000101110b: (2423962804)10010000011110101011110010110100c: (144021314)00001000100101011001011101000010d: (528465800)00011111011111111011111110001000
Data Block: (1651931747)01100010011101100111101001100011R Constant: (6)00000000000000000000000000000110Sin Value: (4096336452)11110100001010010010001001000100
Logic Function: (1568367150)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (3004522335)10110011000101010101111101011111
MD5 Generation Iteration 1: Step 50a = d, d = c, c = b, b = previous resulting value
a: (528465800)00011111011111111011111110001000b: (3004522335)10110011000101010101111101011111c: (2423962804)10010000011110101011110010110100d: (144021314)00001000100101011001011101000010
Data Block: (0)00000000000000000000000000000000R Constant: (10)00000000000000000000000000001010Sin Value: (1126891415)01000011001010101111111110010111
Logic Function: (528465800)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (1964968581)01110101000111110000101010000101
MD5 Generation Iteration 1: Step 51a = d, d = c, c = b, b = previous resulting value
a: (144021314)00001000100101011001011101000010b: (1964968581)01110101000111110000101010000101c: (3004522335)10110011000101010101111101011111d: (2423962804)10010000011110101011110010110100
Data Block: (72)00000000000000000000000001001000R Constant: (15)00000000000000000000000000001111Sin Value: (2878612391)10101011100101000010001110100111
Logic Function: (144021314)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (1560267486)01011100111111111100101011011110
MD5 Generation Iteration 1: Step 52a = d, d = c, c = b, b = previous resulting value
a: (2423962804)10010000011110101011110010110100b: (1560267486)01011100111111111100101011011110c: (1964968581)01110101000111110000101010000101d: (3004522335)10110011000101010101111101011111
Data Block: (0)00000000000000000000000000000000R Constant: (21)00000000000000000000000000010101Sin Value: (4237533241)11111100100100111010000000111001
Logic Function: (2423962804)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (169257157)00001010000101101010100011000101
MD5 Generation Iteration 1: Step 53a = d, d = c, c = b, b = previous resulting value
a: (3004522335)10110011000101010101111101011111b: (169257157)00001010000101101010100011000101c: (1560267486)01011100111111111100101011011110d: (1964968581)01110101000111110000101010000101
Data Block: (0)00000000000000000000000000000000R Constant: (6)00000000000000000000000000000110Sin Value: (1700485571)01100101010110110101100111000011
Logic Function: (3004522335)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (2828188096)10101000100100101011100111000000
MD5 Generation Iteration 1: Step 54a = d, d = c, c = b, b = previous resulting value
a: (1964968581)01110101000111110000101010000101b: (2828188096)10101000100100101011100111000000c: (169257157)00001010000101101010100011000101d: (1560267486)01011100111111111100101011011110
Data Block: (0)00000000000000000000000000000000R Constant: (10)00000000000000000000000000001010Sin Value: (2399980690)10001111000011001100110010010010
Logic Function: (1964968581)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (1749264470)01101000010000111010100001010110
MD5 Generation Iteration 1: Step 55a = d, d = c, c = b, b = previous resulting value
a: (1560267486)01011100111111111100101011011110b: (1749264470)01101000010000111010100001010110c: (2828188096)10101000100100101011100111000000d: (169257157)00001010000101101010100011000101
Data Block: (0)00000000000000000000000000000000R Constant: (15)00000000000000000000000000001111Sin Value: (4293915773)11111111111011111111010001111101
Logic Function: (1560267486)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (3947921802)11101011010100001000000110001010
MD5 Generation Iteration 1: Step 56a = d, d = c, c = b, b = previous resulting value
a: (169257157)00001010000101101010100011000101b: (3947921802)11101011010100001000000110001010c: (1749264470)01101000010000111010100001010110d: (2828188096)10101000100100101011100111000000
Data Block: (1651925858)01100010011101100110001101100010R Constant: (21)00000000000000000000000000010101Sin Value: (2240044497)10000101100001000101110111010001
Logic Function: (169257157)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (662809477)00100111100000011010101110000101
MD5 Generation Iteration 1: Step 57a = d, d = c, c = b, b = previous resulting value
a: (2828188096)10101000100100101011100111000000b: (662809477)00100111100000011010101110000101c: (3947921802)11101011010100001000000110001010d: (1749264470)01101000010000111010100001010110
Data Block: (0)00000000000000000000000000000000R Constant: (6)00000000000000000000000000000110Sin Value: (1873313359)01101111101010000111111001001111
Logic Function: (2828188096)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (1907308834)01110001101011110011100100100010
MD5 Generation Iteration 1: Step 58a = d, d = c, c = b, b = previous resulting value
a: (1749264470)01101000010000111010100001010110b: (1907308834)01110001101011110011100100100010c: (662809477)00100111100000011010101110000101d: (3947921802)11101011010100001000000110001010
Data Block: (0)00000000000000000000000000000000R Constant: (10)00000000000000000000000000001010Sin Value: (4264355552)11111110001011001110011011100000
Logic Function: (1749264470)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (4013939716)11101111001111111101110000000100
MD5 Generation Iteration 1: Step 59a = d, d = c, c = b, b = previous resulting value
a: (3947921802)11101011010100001000000110001010b: (4013939716)11101111001111111101110000000100c: (1907308834)01110001101011110011100100100010d: (662809477)00100111100000011010101110000101
Data Block: (0)00000000000000000000000000000000R Constant: (15)00000000000000000000000000001111Sin Value: (2734768916)10100011000000010100001100010100
Logic Function: (3947921802)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (1144842901)01000100001111001110101010010101
MD5 Generation Iteration 1: Step 60a = d, d = c, c = b, b = previous resulting value
a: (662809477)00100111100000011010101110000101b: (1144842901)01000100001111001110101010010101c: (4013939716)11101111001111111101110000000100d: (1907308834)01110001101011110011100100100010
Data Block: (0)00000000000000000000000000000000R Constant: (21)00000000000000000000000000010101Sin Value: (1309151649)01001110000010000001000110100001
Logic Function: (662809477)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (1143981106)01000100001011111100010000110010
MD5 Generation Iteration 1: Step 61a = d, d = c, c = b, b = previous resulting value
a: (1907308834)01110001101011110011100100100010b: (1143981106)01000100001011111100010000110010c: (1144842901)01000100001111001110101010010101d: (4013939716)11101111001111111101110000000100
Data Block: (0)00000000000000000000000000000000R Constant: (6)00000000000000000000000000000110Sin Value: (4149444226)11110111010100110111111010000010
Logic Function: (1907308834)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (3114338512)10111001101000010000100011010000
MD5 Generation Iteration 1: Step 62a = d, d = c, c = b, b = previous resulting value
a: (4013939716)11101111001111111101110000000100b: (3114338512)10111001101000010000100011010000c: (1143981106)01000100001011111100010000110010d: (1144842901)01000100001111001110101010010101
Data Block: (0)00000000000000000000000000000000R Constant: (10)00000000000000000000000000001010Sin Value: (3174756917)10111101001110101111001000110101
Logic Function: (4013939716)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (3628142465)11011000010000010000111110000001
MD5 Generation Iteration 1: Step 63a = d, d = c, c = b, b = previous resulting value
a: (1144842901)01000100001111001110101010010101b: (3628142465)11011000010000010000111110000001c: (3114338512)10111001101000010000100011010000d: (1143981106)01000100001011111100010000110010
Data Block: (32890)00000000000000001000000001111010R Constant: (15)00000000000000000000000000001111Sin Value: (718787259)00101010110101111101001010111011
Logic Function: (1144842901)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (2461329475)10010010101101001110100001000011
MD5 Generation Iteration 1: Step 64a = d, d = c, c = b, b = previous resulting value
a: (1143981106)01000100001011111100010000110010b: (2461329475)10010010101101001110100001000011c: (3628142465)11011000010000010000111110000001d: (3114338512)10111001101000010000100011010000
Data Block: (0)00000000000000000000000000000000R Constant: (21)00000000000000000000000000010101Sin Value: (3951481745)11101011100001101101001110010001
Logic Function: (1143981106)int result = b + RotateLeft((a + ((c ^ (b | ~d))) + DataBlock + SinValue), R Constant)
Result after shifting: (2833037076)10101000110111001011011100010100
MD5 GenerationAfter Iteration 1: Add the new result to the previous iteration's resulth0 + A: 551955409h1 + B: 2561303197h2 + C: 728745281h3 + D: 3899876343
MD5 GenerationAfter all iterations are completeh0: 551955409 (Hex: d12be620)h1: 2561303197 (Hex: 9d62aa98)h2: 728745281 (Hex: 41c56f2b)h3: 3899876343 (Hex: f76373e8)
The final digest:d12be6209d62aa9841c56f2bf76373e8
MD5 Generation SummaryAs 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.