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

Slides:



Advertisements
Similar presentations
Hashes and Message Digests
Advertisements

Lecture 7 Overview. Advanced Encryption Standard 10, 12, 14 rounds for 128, 192, 256 bit keys – Regular Rounds (9, 11, 13) – Final Round is different.
CS 483 – SD SECTION BY DR. DANIYAL ALGHAZZAWI (3) Information Security.
SECURE HASHING ALGORITHM By: Ruth Betcher. Purpose: Authentication Not Encryption Authentication Requirements:  Masquerade – Insertion of message from.
ECE454/CS594 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2011.
1 Lecture 3: Secret Key Cryptography Outline concepts DES IDEA AES.
MD5 Generation Auto-Generated Slides To Visualize MD5 Hash Generation by Chris Fremgen.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
MD5 Generation Auto-Generated Slides To Visualize MD5 Hash Generation by Chris Fremgen.
MD5 Generation Auto-Generated Slides To Visualize MD5 Hash Generation by Chris Fremgen.
MD5 Generation Auto-Generated Slides To Visualize MD5 Hash Generation by Chris Fremgen.
PIITMadhumita Chatterjee Security 1 Hashes and Message Digests.
1 Chapter 5 Hashes and Message Digests Instructor: 孫宏民 Room: EECS 6402, Tel: , Fax :
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 3: Primitive Data Types.
Announcements: 1. HW7 due next Tuesday. 2. Inauguration today! Questions? This week: Discrete Logs, Diffie-Hellman, ElGamal Discrete Logs, Diffie-Hellman,
Hash functions a hash function produces a fingerprint of some file/message/data h = H(M)  condenses a variable-length message M  to a fixed-sized fingerprint.
Announcements:Questions? This week: Discrete Logs, Diffie-Hellman, ElGamal Discrete Logs, Diffie-Hellman, ElGamal Hash Functions and SHA-1 Hash Functions.
MD5 Message Digest Algorithm CS265 Spring 2003 Jerry Li Computer Science Department San Jose State University.
Hashes and Message Digest Hash is also called message digest One-way function: d=h(m) but no h’(d)=m –Cannot find the message given a digest Cannot find.
Cryptography and Network Security Hash Algorithms.
Chapter 4  Hash Functions 1 Overview  Cryptographic hash functions are functions that: o Map an arbitrary-length (but finite) input to a fixed-size output.
Company LOGO Midterm Presentation Hash Function using MD5 algorithm Students: Eyal Mendel & Aleks Dyskin Instructor: Evgeny Fiksman High Speed Digital.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
1 Pertemuan 09 Hash and Message Digest Matakuliah: H0242 / Keamanan Jaringan Tahun: 2006 Versi: 1.
Lecture 13 Message Signing
MD4 1 MD4. MD4 2 MD4  Message Digest 4  Invented by Rivest, ca 1990  Weaknesses found by 1992 o Rivest proposed improved version (MD5), 1992  Dobbertin.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
1 Cryptography and Network Security (Various Hash Algorithms) Fourth Edition by William Stallings Lecture slides by Lawrie Brown (Changed by Somesh Jha)
Team Grey Skies – Pete Biancaniello and Anton Schraut January 18 th, 2012.
Chapter 8.  Cryptography is the science of keeping information secure in terms of confidentiality and integrity.  Cryptography is also referred to as.
Digital signature using MD5 algorithm Hardware Acceleration
Lecture 15 Lecture’s outline Public algorithms (usually) that are each other’s inverse.
1 Hashes and Message Digests. 2 Hash Also known as –Message digest –One-way function Function: input message -> output One-way: d=h(m), but not h’(d)
12.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 12 Cryptographic Hash Functions.
Hashing Algorithms: Basic Concepts and SHA-2 CSCI 5857: Encoding and Encryption.
Data & Network Security
Iterative Constructs Review l What are named constants? Why are they needed? l What is a block? What is special about declaring a variable inside a block?
Hash and MAC Functions CS427 – Computer Security
Theory of Computation II Topic presented by: Alberto Aguilar Gonzalez.
Cryptographic Hash Functions
Cryptography & Network Security: 1 IX. Hash Algorithms Look at three important hash functions (MD5, SHA-1, RIPEND-160) then look an Internet- standard.
H ASHING : SHA256 T AYLER A NGEVINE B ACHELOR OF A RTS D R. K EN B LAHA 3/13/2014.
Lecture 8 Overview. Secure Hash Algorithm (SHA) SHA SHA SHA – SHA-224, SHA-256, SHA-384, SHA-512 SHA-1 A message composed of b bits.
Chapter 18: One-Way Hash Functions Based on Schneier.
SUNY Oneonta Data Structures and Algorithms Visualization Group MD5 Generation Auto-Generated Slides To Visualize MD5 Hash Generation by Chris Fremgen.
Hash Algorithms see similarities in the evolution of hash functions & block ciphers –increasing power of brute-force attacks –leading to evolution in algorithms.
Hash Functions Ramki Thurimella. 2 What is a hash function? Also known as message digest or fingerprint Compression: A function that maps arbitrarily.
Lecture 5B Block Diagrams HASH Example.
Public-Key Cryptography and Message Authentication
Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 2.3 Hash Functions.
Computer Science and Engineering Computer System Security CSE 5339/7339 Lecture 11 September 23, 2004.
Computer Science and Engineering Computer System Security CSE 5339/7339 Lecture 10 September 21, 2004.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
Network Security. Three tools Hash Function Block Cipher Public Key / Private Key.
1 Chapter3 Public-Key Cryptography and Message Authentication.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
Hash Algorithms Ch 12 of Cryptography and Network Security - Third Edition by William Stallings Modified from lecture slides by Lawrie Brown CIM3681 :
Lecture 9 Overview. RSA Invented by Cocks (GCHQ), independently, by Rivest, Shamir and Adleman (MIT) Two keys e and d used for Encryption and Decryption.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
1 Message Authentication using Message Digests and the MD5 Algorithm Message authentication is important where undetected manipulation of messages can.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 13.Message Authentication.
Secure Hash Algorithm A SEARIES OF SHA….
“The quick brown fox jumps over the lazy dog”
MD5 A Hash Algorithm….
Network Security Unit-III
Secured Hash Algorithm(SHA)
MD5 A Hash Algorithm….
SHA: Secure Hash Algorithm
Presentation transcript:

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. 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.

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.

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

MD5 Generation From User Input User Input String: 'sfgsdfgdfgd' User Input Bytes:

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

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:

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: ( )

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: ( )

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: ( )

MD5 Generation Iteration 1: Step 4 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: ( )

MD5 Generation Iteration 1: Step 5 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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

MD5 Generation Iteration 1: Step 24 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: ( )

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: ( )

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

MD5 Generation Iteration 1: Step 27 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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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

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: ( )

MD5 Generation Iteration 1: Step 38 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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

MD5 Generation Iteration 1: Step 43 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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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

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: ( )

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: ( )

MD5 Generation Iteration 1: Step 54 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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

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: ( )

MD5 Generation Iteration 1: Step 61 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: ( )

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: ( )

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: ( )

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: ( )

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

MD5 Generation After all iterations are complete h0: (Hex: 879f7463) h1: (Hex: f ) h2: (Hex: b8d11efb) h3: (Hex: 2a3ce3e6) The final digest: 879f7463f b8d11efb2a3ce3e6

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.