SlideShare a Scribd company logo
1 of 30
Download to read offline
BCSE309L – Cryptography and Network
Security
https://www.comparitech.com/blog/information-security/md5-algorithm-with-examples/
Message Digest (MD5)
2
Message Digest (MD5)
• MD5 was developed in 1991 by Ronald Rivest
• MD5 is a cryptographic hash function algorithm that
takes the message as input of any length and changes
it into a fixed-length message of 16 bytes.
• MD5 algorithm stands for the message-digest
algorithm.
• The output of MD5 (Digest size) is always 128 bits.
3
Plaintext = multiples of 512 bits
Message digest = 128 bits
Message Digest (MD5)
• Uses
 It is used for file authentication.
 In a web application, it is used for security
purposes. e.g. Secure password of users etc.
 Using this algorithm, We can store our password in
128 bits format
4
Message Digest (MD5)
• Working of MD5 Algorithm
1. Append Padding Bits
2. Append Length Bits
3. Initialize MD buffer
4. Process Each 512-bit Block
5
Message Digest (MD5)
6
L  No. of blocks
Message Digest (MD5)
1. Append Padding Bits
 In the first step, we add padding bits in the original
message in such a way that the total length of the
message is 64 bits less than the exact multiple of 512
7
Length(original message + padding bits) = 512 * i – 64 where i = 1,2,3 . . .
Message Digest (MD5)
Example:
• Plaintext Message: “ They are deterministic”
T  54  01010100
h  68  01101000
e  65  01100101
y  79  01111001
…
01010100 01101000 01100101 01111001 00100000 01100001
01110010 01100101 00100000 01100100 01100101 01110100
01100101 01110010 01101101 01101001 01101110 01101001
01110011 01110100 01101001 01100011
Total 22 letters including blank space  22*8 = 176 bits
ASCII
9
Message Digest (MD5)
10
Length(original message + padding bits) = 512 * i – 64 where i = 1,2,3 . . .
= 512*1-64
= 512 – 64
= 448
Original message + padding = 448
176 + padding bits = 448
padding bits = 448-176
= 272 bits
= 1(1 bit) + 0 (271 bits)
01010100 01101000 01100101 01111001 00100000 01100001 01110010 01100101
00100000 01100100 01100101 01110100 01100101 01110010 01101101 01101001
01101110 01101001 01110011 01110100 01101001 01100011 10000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
272/8=34
Append Padding Bits
Message Digest (MD5)
2. Append Length Bits
 Add length bit in the output of the first step in such a way
that the total number of the bits is the perfect multiple of
512.
 Simply, here we add the 64-bit as a length bit in the output of
the first step.
i.e. output of first step = 512 * n – 64
length bits = 64.
 After adding both, the length of the message = 512 * n 11
Message Digest (MD5)
12
01010100 01101000 01100101 01111001 00100000 01100001 01110010 01100101
00100000 01100100 01100101 01110100 01100101 01110010 01101101 01101001
01101110 01101001 01110011 01110100 01101001 01100011 10000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Append Length Bits
Length of original message = 176
= 10110000
This is the end of the padding scheme, while the preceding 56 bits are all filled up with zeros.
01010100 01101000 01100101 01111001 00100000 01100001 01110010 01100101
00100000 01100100 01100101 01110100 01100101 01110010 01101101 01101001
01101110 01101001 01110011 01110100 01101001 01100011 10000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 10110000
Message Digest (MD5)
3. Initialize MD buffer (– to store output)
 Initialize four different buffers, namely A, B, C, and
D.
 These buffers are 32 bits each and are initialized as
follows:
13
A = 01 23 45 67
B = 89 ab cd ef
C = fe dc ba 98
D = 76 54 32 10
Each buffers= 32bits
Need 4 buffers (A, B, C, D) –
Store 32*4=128 bits
Message Digest (MD5)
4. Process each block:
 Each 512-bit block gets broken down further into 16 sub-
blocks of 32 bits each.
 There are four rounds of operations, with each round
utilizing all the sub-blocks, the buffers, and a constant array
value
 This constant array can be denoted as K[1]  K[64].
 Each of the sub-blocks are denoted as M[0]  M[15]
14
Length of message = 512 * n
Each block= 512 bits
Message Digest (MD5)
512-bit M needs to be split into sixteen 32-bit “words”
M0 – 01010100 01101000 01100101 01111001
M1 – 00100000 01100001 01110010 01100101
M2 – 00100000 01100100 01100101 01110100
M3 – 01100101 01110010 01101101 01101001
M4 – 01101110 01101001 01110011 01110100
M5 – 01101001 01100011 10000000 00000000
M6 – 00000000 00000000 00000000 00000000
M7 – 00000000 00000000 00000000 00000000
M8 – 00000000 00000000 00000000 00000000
M9 – 00000000 00000000 00000000 00000000
M10 – 00000000 00000000 00000000 00000000
M11 – 00000000 00000000 00000000 00000000
M12 – 00000000 00000000 00000000 00000000
M13 – 00000000 00000000 00000000 00000000
M14 – 00000000 00000000 00000000 00000000
M15 – 00000000 00000000 00000000 10110000
Message Digest (MD5)
M0 – 01010100 01101000 01100101 01111001
M1 – 00100000 01100001 01110010 01100101
M2 – 00100000 01100100 01100101 01110100
M3 – 01100101 01110010 01101101 01101001
M4 – 01101110 01101001 01110011 01110100
M5 – 01101001 01100011 10000000 00000000
M6 – 00000000 00000000 00000000 00000000
M7 – 00000000 00000000 00000000 00000000
M8 – 00000000 00000000 00000000 00000000
M9 – 00000000 00000000 00000000 00000000
M10 – 00000000 00000000 00000000 00000000
M11 – 00000000 00000000 00000000 00000000
M12 – 00000000 00000000 00000000 00000000
M13 – 00000000 00000000 00000000 00000000
M14 – 00000000 00000000 00000000 00000000
M15 – 00000000 00000000 00000000 10110000
M0 – 54686579
M1 – 20617265
M2 – 20646574
M3 – 65726D69
M4 – 6E697374
M5 – 69638000
M6 – 00000000
M7 – 00000000
M8 – 00000000
M9 – 00000000
M10 – 00000000
M11 – 00000000
M12 – 00000000
M13 – 00000000
M14 – 00000000
M15 – 000000B0
Message Digest (MD5)
• Each of these M inputs (512 bits)
are used in every single round,
they are added in different orders.
In second round:
M1, M6, M11, M0, M5, M10, M15, M4,
M9, M14, M3, M8, M13, M2, M7, M12
In third round
M5, M8, M11, M14, M1, M4, M7, M10,
M13, M0, M3, M6, M9, M12, M15, M2
In fourth round
M0, M7, M14, M5, M12, M3, M10, M1,
M8, M15, M6, M13, M4, M11, M2, M9
17
Operation carried out
on Every 512 bit block
Message Digest (MD5)
• Initialization vector
18
A – 01234567
B – 89abcdef
C – fedcba98
D – 76543210
M0 – 54686579
M1 – 20617265
M2 – 20646574
M3 – 65726D69
M4 – 6E697374
M5 – 69638000
M6 – 00000000
M7 – 00000000
M8 – 00000000
M9 – 00000000
M10 – 00000000
M11 – 00000000
M12 – 00000000
M13 – 00000000
M14 – 00000000
M15 – 000000B0
Message Digest (MD5)
• Initialization vector
19
A – 01234567
B – 89abcdef
C – fedcba98
D – 76543210
M0 – 54686579
M1 – 20617265
M2 – 20646574
M3 – 65726D69
M4 – 6E697374
M5 – 69638000
M6 – 00000000
M7 – 00000000
M8 – 00000000
M9 – 00000000
M10 – 00000000
M11 – 00000000
M12 – 00000000
M13 – 00000000
M14 – 00000000
M15 – 000000B0
20
The values for K are is derived from the formula
K1 – D76AA478
K2 – E8C7B756
K3 – 242070DB
K4 – C1BDCEEE
K5 – F57COFA
K6 – 4787C62A
K7 – A8304613
K8 – FD469501
K9 – 698098D8
K10 – 8B44F7AF
K11 – FFFF5BB1
K12 – 895CD7BE
K13 – 6B901122
K14 – FD987193
K15 – A679438E
K16 – 49B40821
K17 – F61E2562
K18 – C040B340
K19 – 265E5A51
K20 – E9B6C7AA
K21 – D62F105D
K22 – 02441453
K23 – D8A1E681
K24 – E7D3FBC8
K25 – 21E1CDE6
K26 – C33707D6
K27 – F4D50D87
K28 – 455A14ED
K29 – A9E3E905
K30 – FCEFA3F8
K31 – 676F02D9
K32 – 8D2A4C8A
K33 – FFFA3942
K34 – 8771F681
K35 – 699D6122
K36 – FDE5380C
K37– A4BEEA44
K38 – 4BDECFA9
K39 – F6BB4B60
K40 – BEBFBC70
K41 – 289B7EC6
K42 – EAA127FA
K43 – D4EF3085
K44 – 04881D05
K45 – D9D4D039
K46 – E6DB99E5
K47 – 1FA27CF8
K48 – C4AC5665
K49 – F4292244
K50 – 432AFF97
K51 – AB9423A7
K52 – FC93A039
K53 – 655B59C3
K54 – 8F0CCC92
K55 – FFEFF47D
K56 – 85845DD1
K57 – 6FA87E4F
K58 – FE2CE6E0
K59 – A3014314
K60 – 4E0811A1
K61 – F7537E82
K62 – BD3AF235
K63 – 2AD7D2BB
K64 – EB86D391
Round1 Round2 Round3 Round4
Round Operation
Message Digest (MD5)
Each block  4 rounds of operation
• In each round  16 operations are performed
– Total  64 operations are performed in 4 rounds.
• 1st round  16 operations will be performed
• 2nd round  16 operations will be performed
• 3rd round  16 operations will be performed
• 4th round  16 operations will be performed.
• We apply a different function on each round i.e. for the
– 1st round we apply the F function,
– 2nd G function
– 3rd for the H function
– 4th for the I function.
21
Message Digest (MD5)
• Each round has 16 steps of the form:
b = b+((a+f(b,c,d)+M[i]+K[i])<<<s)
22
• Constant array : K[1]  K[64].
• K[1-16]
• K[17-32]
• K[33-48]
• K[49-64]
• Each of the sub-blocks : M[0]  M[15]
• M[0]  32bits
• M[1]  32bits
• …
• M[15]  32bits
g(b,c,d) is a different nonlinear
function in each round (F,G,H,I)
Message Digest (MD5)
• g(b,c,d) is a different nonlinear function in each round
(F,G,H,I)
• Perform OR, AND, XOR, and NOT (basically these are
logic gates) for calculating functions
• Use 3 buffers for each function
23
F(B,C,D) = (B AND C) OR (NOT B AND D)
G(B,C,D) = (B AND C) OR (C AND NOT D)
H(B,C,D) = B XOR C XOR D
I(B,C,D) = C XOR (B OR NOT D)
The values for K are is derived from the formula
K1 – D76AA478
K2 – E8C7B756
K3 – 242070DB
K4 – C1BDCEEE
K5 – F57COFA
K6 – 4787C62A
K7 – A8304613
K8 – FD469501
K9 – 698098D8
K10 – 8B44F7AF
K11 – FFFF5BB1
K12 – 895CD7BE
K13 – 6B901122
K14 – FD987193
K15 – A679438E
K16 – 49B40821
K17 – F61E2562
K18 – C040B340
K19 – 265E5A51
K20 – E9B6C7AA
K21 – D62F105D
K22 – 02441453
K23 – D8A1E681
K24 – E7D3FBC8
K25 – 21E1CDE6
K26 – C33707D6
K27 – F4D50D87
K28 – 455A14ED
K29 – A9E3E905
K30 – FCEFA3F8
K31 – 676F02D9
K32 – 8D2A4C8A
K33 – FFFA3942
K34 – 8771F681
K35 – 699D6122
K36 – FDE5380C
K37– A4BEEA44
K38 – 4BDECFA9
K39 – F6BB4B60
K40 – BEBFBC70
K41 – 289B7EC6
K42 – EAA127FA
K43 – D4EF3085
K44 – 04881D05
K45 – D9D4D039
K46 – E6DB99E5
K47 – 1FA27CF8
K48 – C4AC5665
K49 – F4292244
K50 – 432AFF97
K51 – AB9423A7
K52 – FC93A039
K53 – 655B59C3
K54 – 8F0CCC92
K55 – FFEFF47D
K56 – 85845DD1
K57 – 6FA87E4F
K58 – FE2CE6E0
K59 – A3014314
K60 – 4E0811A1
K61 – F7537E82
K62 – BD3AF235
K63 – 2AD7D2BB
K64 – EB86D391
MD5 F, G, H and I functions
F(B, C, D) = (B∧C)∨(¬B∧D)
G(B, C, D) = (B∧D)∨(C∧¬D)
H(B, C, D) =B⊕C⊕D
I(B, C, D) = C⊕(B∨¬D)
Round1 Round2 Round3 Round4
A – 01234567
B – 89abcdef
C – fedcba98
D – 76543210
M0 – 54686579
M1 – 20617265
M2 – 20646574
M3 – 65726D69
M4 – 6E697374
M5 – 69638000
M6 – 00000000
M7 – 00000000
M8 – 00000000
M9 – 00000000
M10 – 00000000
M11 – 00000000
M12 – 00000000
M13 – 00000000
M14 – 00000000
M15 – 000000B0
25
MD5 F, G, H and I functions
F(B, C, D) = (B∧C)∨(¬B∧D)
G(B, C, D) = (B∧D)∨(C∧¬D)
H(B, C, D) =B⊕C⊕D
I(B, C, D) = C⊕(B∨¬D)
F (89abcdef, fedcba98, 76543210) = (89abcdef AND fedcba98) OR (NOT-89abcdef AND 76543210)
F(B, C, D) = 88888888 OR 76543210
= fedcba98
Modular Addition  (X + Y) mod Z
X01234567
Yfedcba98
Z100000000 (232)
(X + Y) mod Z
= (01234567 + fedcba98) mod 100000000
= ffffffff mod 100000000
= ffffffff
26
MD5 F, G, H and I functions
F(B, C, D) = (B∧C)∨(¬B∧D)
G(B, C, D) = (B∧D)∨(C∧¬D)
H(B, C, D) =B⊕C⊕D
I(B, C, D) = C⊕(B∨¬D)
F (89abcdef, fedcba98, 76543210) = (89abcdef AND fedcba98) OR (NOT-89abcdef AND 76543210)
F(B, C, D) = 88888888 OR 76543210
= fedcba98
Modular Addition  ffffffff
(X + Y) mod Z
X  M0 = 54686579
Y ffffffff
Z100000000 (232)
(X + Y) mod Z
= (54686579 + ffffffff) mod 100000000
= 154686578
27
MD5 F, G, H and I functions
F(B, C, D) = (B∧C)∨(¬B∧D)
G(B, C, D) = (B∧D)∨(C∧¬D)
H(B, C, D) =B⊕C⊕D
I(B, C, D) = C⊕(B∨¬D)
F (89abcdef, fedcba98, 76543210) = (89abcdef AND fedcba98) OR (NOT-89abcdef AND 76543210)
F(B, C, D) = 88888888 OR 76543210
= fedcba98
Modular Addition  154686578
(X + Y) mod Z
X  K0 = d76aa478
Y 154686578
Z100000000 (232)
(X + Y) mod Z
= (d76aa478 + 54686578) mod 100000000
= 2bd309f0
28
The values for K are is derived from the formula
K1 – D76AA478
K2 – E8C7B756
K3 – 242070DB
K4 – C1BDCEEE
K5 – F57COFA
K6 – 4787C62A
K7 – A8304613
K8 – FD469501
K9 – 698098D8
K10 – 8B44F7AF
K11 – FFFF5BB1
K12 – 895CD7BE
K13 – 6B901122
K14 – FD987193
K15 – A679438E
K16 – 49B40821
K17 – F61E2562
K18 – C040B340
K19 – 265E5A51
K20 – E9B6C7AA
K21 – D62F105D
K22 – 02441453
K23 – D8A1E681
K24 – E7D3FBC8
K25 – 21E1CDE6
K26 – C33707D6
K27 – F4D50D87
K28 – 455A14ED
K29 – A9E3E905
K30 – FCEFA3F8
K31 – 676F02D9
K32 – 8D2A4C8A
K33 – FFFA3942
K34 – 8771F681
K35 – 699D6122
K36 – FDE5380C
K37– A4BEEA44
K38 – 4BDECFA9
K39 – F6BB4B60
K40 – BEBFBC70
K41 – 289B7EC6
K42 – EAA127FA
K43 – D4EF3085
K44 – 04881D05
K45 – D9D4D039
K46 – E6DB99E5
K47 – 1FA27CF8
K48 – C4AC5665
K49 – F4292244
K50 – 432AFF97
K51 – AB9423A7
K52 – FC93A039
K53 – 655B59C3
K54 – 8F0CCC92
K55 – FFEFF47D
K56 – 85845DD1
K57 – 6FA87E4F
K58 – FE2CE6E0
K59 – A3014314
K60 – 4E0811A1
K61 – F7537E82
K62 – BD3AF235
K63 – 2AD7D2BB
K64 – EB86D391
MD5 F, G, H and I functions
F(B, C, D) = (B∧C)∨(¬B∧D)
G(B, C, D) = (B∧D)∨(C∧¬D)
H(B, C, D) =B⊕C⊕D
I(B, C, D) = C⊕(B∨¬D)
Round1 Round2 Round3 Round4
29
MD5 F, G, H and I functions
F(B, C, D) = (B∧C)∨(¬B∧D)
G(B, C, D) = (B∧D)∨(C∧¬D)
H(B, C, D) =B⊕C⊕D
I(B, C, D) = C⊕(B∨¬D)
F (89abcdef, fedcba98, 76543210) = (89abcdef AND fedcba98) OR (NOT-89abcdef AND 76543210)
F(B, C, D) = 88888888 OR 76543210
= fedcba98
Modular Addition  2bd309f0
Left bit shift
0010 1011 1101 0011 0000 1001 1111 0000
001 0101 1110 1001 1000 0100 1111 1000 0xxx xxxx
Shift 7 bits left
1110 1001 1000 0100 1111 1000 0001 0101
In hexa
e984f815
A – 01234567
B – 89abcdef
C – fedcba98
D – 76543210
(X + Y) mod Z
X  B = 89abcdef
Y e984f815
Z100000000 (232)
(X + Y) mod Z
= (89abcdef + e984f895) mod 100000000
= 7330C604
A – 76543210
B – 7330c604
C – 89abcdef
D – fedcba98
2bd309f0
First operation in Round1 is completed
Similarly do other 63 operations and generate
the final Message Digest of 128 bits

More Related Content

Similar to CNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphy

MD5 ALGORITHM.pptx
MD5 ALGORITHM.pptxMD5 ALGORITHM.pptx
MD5 ALGORITHM.pptxRajapriya82
 
Basic explanation to md5 implementation in C
Basic explanation to md5 implementation in CBasic explanation to md5 implementation in C
Basic explanation to md5 implementation in CSourav Punoriyar
 
Blockchain Technology - Week 6 - Role of Cryptography in Blockchain
Blockchain Technology - Week 6 - Role of Cryptography in BlockchainBlockchain Technology - Week 6 - Role of Cryptography in Blockchain
Blockchain Technology - Week 6 - Role of Cryptography in BlockchainFerdin Joe John Joseph PhD
 
Mcs 012 computer organisation and assemly language programming- ignou assignm...
Mcs 012 computer organisation and assemly language programming- ignou assignm...Mcs 012 computer organisation and assemly language programming- ignou assignm...
Mcs 012 computer organisation and assemly language programming- ignou assignm...Dr. Loganathan R
 
crypto secure-hash-algorithm-versions.ppt
crypto secure-hash-algorithm-versions.pptcrypto secure-hash-algorithm-versions.ppt
crypto secure-hash-algorithm-versions.pptshuchiagarwal12
 
Chapter 3-Data Representation in Computers.ppt
Chapter 3-Data Representation in Computers.pptChapter 3-Data Representation in Computers.ppt
Chapter 3-Data Representation in Computers.pptKalGetachew2
 
A Comparative Analysis between SHA and MD5 algorithms
A Comparative Analysis between SHA and MD5 algorithms A Comparative Analysis between SHA and MD5 algorithms
A Comparative Analysis between SHA and MD5 algorithms Er Piyush Gupta IN ⊞⌘
 
Cryptography Symmetric Key Algorithm (CSE)
Cryptography Symmetric Key Algorithm (CSE)Cryptography Symmetric Key Algorithm (CSE)
Cryptography Symmetric Key Algorithm (CSE)SoumyaBhattacharyya14
 
VLSI DESIGN Conference 2016, Kolkata- Authenticated Encryption Decryption
VLSI DESIGN Conference 2016, Kolkata- Authenticated Encryption DecryptionVLSI DESIGN Conference 2016, Kolkata- Authenticated Encryption Decryption
VLSI DESIGN Conference 2016, Kolkata- Authenticated Encryption DecryptionHardik Manocha
 

Similar to CNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphy (20)

Sha
ShaSha
Sha
 
MD5 ALGORITHM.pptx
MD5 ALGORITHM.pptxMD5 ALGORITHM.pptx
MD5 ALGORITHM.pptx
 
Secure Hash Algorithm
Secure Hash AlgorithmSecure Hash Algorithm
Secure Hash Algorithm
 
Basic explanation to md5 implementation in C
Basic explanation to md5 implementation in CBasic explanation to md5 implementation in C
Basic explanation to md5 implementation in C
 
Blockchain Technology - Week 6 - Role of Cryptography in Blockchain
Blockchain Technology - Week 6 - Role of Cryptography in BlockchainBlockchain Technology - Week 6 - Role of Cryptography in Blockchain
Blockchain Technology - Week 6 - Role of Cryptography in Blockchain
 
Secure hashing algorithm
Secure hashing algorithmSecure hashing algorithm
Secure hashing algorithm
 
Mcs 012 computer organisation and assemly language programming- ignou assignm...
Mcs 012 computer organisation and assemly language programming- ignou assignm...Mcs 012 computer organisation and assemly language programming- ignou assignm...
Mcs 012 computer organisation and assemly language programming- ignou assignm...
 
crypto secure-hash-algorithm-versions.ppt
crypto secure-hash-algorithm-versions.pptcrypto secure-hash-algorithm-versions.ppt
crypto secure-hash-algorithm-versions.ppt
 
Chapter 3-Data Representation in Computers.ppt
Chapter 3-Data Representation in Computers.pptChapter 3-Data Representation in Computers.ppt
Chapter 3-Data Representation in Computers.ppt
 
A Comparative Analysis between SHA and MD5 algorithms
A Comparative Analysis between SHA and MD5 algorithms A Comparative Analysis between SHA and MD5 algorithms
A Comparative Analysis between SHA and MD5 algorithms
 
MD5
MD5MD5
MD5
 
DESIGN OF COMBINATIONAL LOGIC
DESIGN OF COMBINATIONAL LOGICDESIGN OF COMBINATIONAL LOGIC
DESIGN OF COMBINATIONAL LOGIC
 
Cryptography Symmetric Key Algorithm (CSE)
Cryptography Symmetric Key Algorithm (CSE)Cryptography Symmetric Key Algorithm (CSE)
Cryptography Symmetric Key Algorithm (CSE)
 
VLSI DESIGN Conference 2016, Kolkata- Authenticated Encryption Decryption
VLSI DESIGN Conference 2016, Kolkata- Authenticated Encryption DecryptionVLSI DESIGN Conference 2016, Kolkata- Authenticated Encryption Decryption
VLSI DESIGN Conference 2016, Kolkata- Authenticated Encryption Decryption
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 
Hash function
Hash functionHash function
Hash function
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 

Recently uploaded

OSU毕业证留学文凭,制做办理
OSU毕业证留学文凭,制做办理OSU毕业证留学文凭,制做办理
OSU毕业证留学文凭,制做办理cowagem
 
CFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceCFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceSanjay Bokadia
 
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...Suhani Kapoor
 
Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...
Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...
Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...Niya Khan
 
Vip Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...
Vip  Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...Vip  Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...
Vip Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...shivangimorya083
 
Production Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbjProduction Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbjLewisJB
 
Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineResumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineBruce Bennett
 
Internshala Student Partner 6.0 Jadavpur University Certificate
Internshala Student Partner 6.0 Jadavpur University CertificateInternshala Student Partner 6.0 Jadavpur University Certificate
Internshala Student Partner 6.0 Jadavpur University CertificateSoham Mondal
 
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...Suhani Kapoor
 
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen DatingDubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Datingkojalkojal131
 
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service 🧳
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service  🧳CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service  🧳
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service 🧳anilsa9823
 
Call Girl in Low Price Delhi Punjabi Bagh 9711199012
Call Girl in Low Price Delhi Punjabi Bagh  9711199012Call Girl in Low Price Delhi Punjabi Bagh  9711199012
Call Girl in Low Price Delhi Punjabi Bagh 9711199012sapnasaifi408
 
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...Suhani Kapoor
 
Employee of the Month - Samsung Semiconductor India Research
Employee of the Month - Samsung Semiconductor India ResearchEmployee of the Month - Samsung Semiconductor India Research
Employee of the Month - Samsung Semiconductor India ResearchSoham Mondal
 
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call GirlsDelhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girlsshivangimorya083
 
Experience Certificate - Marketing Analyst-Soham Mondal.pdf
Experience Certificate - Marketing Analyst-Soham Mondal.pdfExperience Certificate - Marketing Analyst-Soham Mondal.pdf
Experience Certificate - Marketing Analyst-Soham Mondal.pdfSoham Mondal
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceanilsa9823
 
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...Suhani Kapoor
 
PM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring ChapterPM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring ChapterHector Del Castillo, CPM, CPMM
 

Recently uploaded (20)

OSU毕业证留学文凭,制做办理
OSU毕业证留学文凭,制做办理OSU毕业证留学文凭,制做办理
OSU毕业证留学文凭,制做办理
 
CFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceCFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector Experience
 
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
 
Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...
Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...
Neha +91-9537192988-Friendly Ahmedabad Call Girls has Complete Authority for ...
 
Vip Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...
Vip  Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...Vip  Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...
Vip Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...
 
Production Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbjProduction Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbj
 
Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineResumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying Online
 
Internshala Student Partner 6.0 Jadavpur University Certificate
Internshala Student Partner 6.0 Jadavpur University CertificateInternshala Student Partner 6.0 Jadavpur University Certificate
Internshala Student Partner 6.0 Jadavpur University Certificate
 
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
 
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen DatingDubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
 
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service 🧳
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service  🧳CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service  🧳
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service 🧳
 
Call Girl in Low Price Delhi Punjabi Bagh 9711199012
Call Girl in Low Price Delhi Punjabi Bagh  9711199012Call Girl in Low Price Delhi Punjabi Bagh  9711199012
Call Girl in Low Price Delhi Punjabi Bagh 9711199012
 
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
 
Employee of the Month - Samsung Semiconductor India Research
Employee of the Month - Samsung Semiconductor India ResearchEmployee of the Month - Samsung Semiconductor India Research
Employee of the Month - Samsung Semiconductor India Research
 
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call GirlsDelhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
 
Experience Certificate - Marketing Analyst-Soham Mondal.pdf
Experience Certificate - Marketing Analyst-Soham Mondal.pdfExperience Certificate - Marketing Analyst-Soham Mondal.pdf
Experience Certificate - Marketing Analyst-Soham Mondal.pdf
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
 
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
 
PM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring ChapterPM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring Chapter
 
Call Girls In Prashant Vihar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCe
Call Girls In Prashant Vihar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCeCall Girls In Prashant Vihar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCe
Call Girls In Prashant Vihar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCe
 

CNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphy

  • 1. BCSE309L – Cryptography and Network Security https://www.comparitech.com/blog/information-security/md5-algorithm-with-examples/
  • 3. Message Digest (MD5) • MD5 was developed in 1991 by Ronald Rivest • MD5 is a cryptographic hash function algorithm that takes the message as input of any length and changes it into a fixed-length message of 16 bytes. • MD5 algorithm stands for the message-digest algorithm. • The output of MD5 (Digest size) is always 128 bits. 3 Plaintext = multiples of 512 bits Message digest = 128 bits
  • 4. Message Digest (MD5) • Uses  It is used for file authentication.  In a web application, it is used for security purposes. e.g. Secure password of users etc.  Using this algorithm, We can store our password in 128 bits format 4
  • 5. Message Digest (MD5) • Working of MD5 Algorithm 1. Append Padding Bits 2. Append Length Bits 3. Initialize MD buffer 4. Process Each 512-bit Block 5
  • 6. Message Digest (MD5) 6 L  No. of blocks
  • 7. Message Digest (MD5) 1. Append Padding Bits  In the first step, we add padding bits in the original message in such a way that the total length of the message is 64 bits less than the exact multiple of 512 7 Length(original message + padding bits) = 512 * i – 64 where i = 1,2,3 . . .
  • 8. Message Digest (MD5) Example: • Plaintext Message: “ They are deterministic” T  54  01010100 h  68  01101000 e  65  01100101 y  79  01111001 … 01010100 01101000 01100101 01111001 00100000 01100001 01110010 01100101 00100000 01100100 01100101 01110100 01100101 01110010 01101101 01101001 01101110 01101001 01110011 01110100 01101001 01100011 Total 22 letters including blank space  22*8 = 176 bits ASCII
  • 9. 9
  • 10. Message Digest (MD5) 10 Length(original message + padding bits) = 512 * i – 64 where i = 1,2,3 . . . = 512*1-64 = 512 – 64 = 448 Original message + padding = 448 176 + padding bits = 448 padding bits = 448-176 = 272 bits = 1(1 bit) + 0 (271 bits) 01010100 01101000 01100101 01111001 00100000 01100001 01110010 01100101 00100000 01100100 01100101 01110100 01100101 01110010 01101101 01101001 01101110 01101001 01110011 01110100 01101001 01100011 10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 272/8=34 Append Padding Bits
  • 11. Message Digest (MD5) 2. Append Length Bits  Add length bit in the output of the first step in such a way that the total number of the bits is the perfect multiple of 512.  Simply, here we add the 64-bit as a length bit in the output of the first step. i.e. output of first step = 512 * n – 64 length bits = 64.  After adding both, the length of the message = 512 * n 11
  • 12. Message Digest (MD5) 12 01010100 01101000 01100101 01111001 00100000 01100001 01110010 01100101 00100000 01100100 01100101 01110100 01100101 01110010 01101101 01101001 01101110 01101001 01110011 01110100 01101001 01100011 10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 Append Length Bits Length of original message = 176 = 10110000 This is the end of the padding scheme, while the preceding 56 bits are all filled up with zeros. 01010100 01101000 01100101 01111001 00100000 01100001 01110010 01100101 00100000 01100100 01100101 01110100 01100101 01110010 01101101 01101001 01101110 01101001 01110011 01110100 01101001 01100011 10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 10110000
  • 13. Message Digest (MD5) 3. Initialize MD buffer (– to store output)  Initialize four different buffers, namely A, B, C, and D.  These buffers are 32 bits each and are initialized as follows: 13 A = 01 23 45 67 B = 89 ab cd ef C = fe dc ba 98 D = 76 54 32 10 Each buffers= 32bits Need 4 buffers (A, B, C, D) – Store 32*4=128 bits
  • 14. Message Digest (MD5) 4. Process each block:  Each 512-bit block gets broken down further into 16 sub- blocks of 32 bits each.  There are four rounds of operations, with each round utilizing all the sub-blocks, the buffers, and a constant array value  This constant array can be denoted as K[1]  K[64].  Each of the sub-blocks are denoted as M[0]  M[15] 14 Length of message = 512 * n Each block= 512 bits
  • 15. Message Digest (MD5) 512-bit M needs to be split into sixteen 32-bit “words” M0 – 01010100 01101000 01100101 01111001 M1 – 00100000 01100001 01110010 01100101 M2 – 00100000 01100100 01100101 01110100 M3 – 01100101 01110010 01101101 01101001 M4 – 01101110 01101001 01110011 01110100 M5 – 01101001 01100011 10000000 00000000 M6 – 00000000 00000000 00000000 00000000 M7 – 00000000 00000000 00000000 00000000 M8 – 00000000 00000000 00000000 00000000 M9 – 00000000 00000000 00000000 00000000 M10 – 00000000 00000000 00000000 00000000 M11 – 00000000 00000000 00000000 00000000 M12 – 00000000 00000000 00000000 00000000 M13 – 00000000 00000000 00000000 00000000 M14 – 00000000 00000000 00000000 00000000 M15 – 00000000 00000000 00000000 10110000
  • 16. Message Digest (MD5) M0 – 01010100 01101000 01100101 01111001 M1 – 00100000 01100001 01110010 01100101 M2 – 00100000 01100100 01100101 01110100 M3 – 01100101 01110010 01101101 01101001 M4 – 01101110 01101001 01110011 01110100 M5 – 01101001 01100011 10000000 00000000 M6 – 00000000 00000000 00000000 00000000 M7 – 00000000 00000000 00000000 00000000 M8 – 00000000 00000000 00000000 00000000 M9 – 00000000 00000000 00000000 00000000 M10 – 00000000 00000000 00000000 00000000 M11 – 00000000 00000000 00000000 00000000 M12 – 00000000 00000000 00000000 00000000 M13 – 00000000 00000000 00000000 00000000 M14 – 00000000 00000000 00000000 00000000 M15 – 00000000 00000000 00000000 10110000 M0 – 54686579 M1 – 20617265 M2 – 20646574 M3 – 65726D69 M4 – 6E697374 M5 – 69638000 M6 – 00000000 M7 – 00000000 M8 – 00000000 M9 – 00000000 M10 – 00000000 M11 – 00000000 M12 – 00000000 M13 – 00000000 M14 – 00000000 M15 – 000000B0
  • 17. Message Digest (MD5) • Each of these M inputs (512 bits) are used in every single round, they are added in different orders. In second round: M1, M6, M11, M0, M5, M10, M15, M4, M9, M14, M3, M8, M13, M2, M7, M12 In third round M5, M8, M11, M14, M1, M4, M7, M10, M13, M0, M3, M6, M9, M12, M15, M2 In fourth round M0, M7, M14, M5, M12, M3, M10, M1, M8, M15, M6, M13, M4, M11, M2, M9 17 Operation carried out on Every 512 bit block
  • 18. Message Digest (MD5) • Initialization vector 18 A – 01234567 B – 89abcdef C – fedcba98 D – 76543210 M0 – 54686579 M1 – 20617265 M2 – 20646574 M3 – 65726D69 M4 – 6E697374 M5 – 69638000 M6 – 00000000 M7 – 00000000 M8 – 00000000 M9 – 00000000 M10 – 00000000 M11 – 00000000 M12 – 00000000 M13 – 00000000 M14 – 00000000 M15 – 000000B0
  • 19. Message Digest (MD5) • Initialization vector 19 A – 01234567 B – 89abcdef C – fedcba98 D – 76543210 M0 – 54686579 M1 – 20617265 M2 – 20646574 M3 – 65726D69 M4 – 6E697374 M5 – 69638000 M6 – 00000000 M7 – 00000000 M8 – 00000000 M9 – 00000000 M10 – 00000000 M11 – 00000000 M12 – 00000000 M13 – 00000000 M14 – 00000000 M15 – 000000B0
  • 20. 20 The values for K are is derived from the formula K1 – D76AA478 K2 – E8C7B756 K3 – 242070DB K4 – C1BDCEEE K5 – F57COFA K6 – 4787C62A K7 – A8304613 K8 – FD469501 K9 – 698098D8 K10 – 8B44F7AF K11 – FFFF5BB1 K12 – 895CD7BE K13 – 6B901122 K14 – FD987193 K15 – A679438E K16 – 49B40821 K17 – F61E2562 K18 – C040B340 K19 – 265E5A51 K20 – E9B6C7AA K21 – D62F105D K22 – 02441453 K23 – D8A1E681 K24 – E7D3FBC8 K25 – 21E1CDE6 K26 – C33707D6 K27 – F4D50D87 K28 – 455A14ED K29 – A9E3E905 K30 – FCEFA3F8 K31 – 676F02D9 K32 – 8D2A4C8A K33 – FFFA3942 K34 – 8771F681 K35 – 699D6122 K36 – FDE5380C K37– A4BEEA44 K38 – 4BDECFA9 K39 – F6BB4B60 K40 – BEBFBC70 K41 – 289B7EC6 K42 – EAA127FA K43 – D4EF3085 K44 – 04881D05 K45 – D9D4D039 K46 – E6DB99E5 K47 – 1FA27CF8 K48 – C4AC5665 K49 – F4292244 K50 – 432AFF97 K51 – AB9423A7 K52 – FC93A039 K53 – 655B59C3 K54 – 8F0CCC92 K55 – FFEFF47D K56 – 85845DD1 K57 – 6FA87E4F K58 – FE2CE6E0 K59 – A3014314 K60 – 4E0811A1 K61 – F7537E82 K62 – BD3AF235 K63 – 2AD7D2BB K64 – EB86D391 Round1 Round2 Round3 Round4 Round Operation
  • 21. Message Digest (MD5) Each block  4 rounds of operation • In each round  16 operations are performed – Total  64 operations are performed in 4 rounds. • 1st round  16 operations will be performed • 2nd round  16 operations will be performed • 3rd round  16 operations will be performed • 4th round  16 operations will be performed. • We apply a different function on each round i.e. for the – 1st round we apply the F function, – 2nd G function – 3rd for the H function – 4th for the I function. 21
  • 22. Message Digest (MD5) • Each round has 16 steps of the form: b = b+((a+f(b,c,d)+M[i]+K[i])<<<s) 22 • Constant array : K[1]  K[64]. • K[1-16] • K[17-32] • K[33-48] • K[49-64] • Each of the sub-blocks : M[0]  M[15] • M[0]  32bits • M[1]  32bits • … • M[15]  32bits g(b,c,d) is a different nonlinear function in each round (F,G,H,I)
  • 23. Message Digest (MD5) • g(b,c,d) is a different nonlinear function in each round (F,G,H,I) • Perform OR, AND, XOR, and NOT (basically these are logic gates) for calculating functions • Use 3 buffers for each function 23 F(B,C,D) = (B AND C) OR (NOT B AND D) G(B,C,D) = (B AND C) OR (C AND NOT D) H(B,C,D) = B XOR C XOR D I(B,C,D) = C XOR (B OR NOT D)
  • 24. The values for K are is derived from the formula K1 – D76AA478 K2 – E8C7B756 K3 – 242070DB K4 – C1BDCEEE K5 – F57COFA K6 – 4787C62A K7 – A8304613 K8 – FD469501 K9 – 698098D8 K10 – 8B44F7AF K11 – FFFF5BB1 K12 – 895CD7BE K13 – 6B901122 K14 – FD987193 K15 – A679438E K16 – 49B40821 K17 – F61E2562 K18 – C040B340 K19 – 265E5A51 K20 – E9B6C7AA K21 – D62F105D K22 – 02441453 K23 – D8A1E681 K24 – E7D3FBC8 K25 – 21E1CDE6 K26 – C33707D6 K27 – F4D50D87 K28 – 455A14ED K29 – A9E3E905 K30 – FCEFA3F8 K31 – 676F02D9 K32 – 8D2A4C8A K33 – FFFA3942 K34 – 8771F681 K35 – 699D6122 K36 – FDE5380C K37– A4BEEA44 K38 – 4BDECFA9 K39 – F6BB4B60 K40 – BEBFBC70 K41 – 289B7EC6 K42 – EAA127FA K43 – D4EF3085 K44 – 04881D05 K45 – D9D4D039 K46 – E6DB99E5 K47 – 1FA27CF8 K48 – C4AC5665 K49 – F4292244 K50 – 432AFF97 K51 – AB9423A7 K52 – FC93A039 K53 – 655B59C3 K54 – 8F0CCC92 K55 – FFEFF47D K56 – 85845DD1 K57 – 6FA87E4F K58 – FE2CE6E0 K59 – A3014314 K60 – 4E0811A1 K61 – F7537E82 K62 – BD3AF235 K63 – 2AD7D2BB K64 – EB86D391 MD5 F, G, H and I functions F(B, C, D) = (B∧C)∨(¬B∧D) G(B, C, D) = (B∧D)∨(C∧¬D) H(B, C, D) =B⊕C⊕D I(B, C, D) = C⊕(B∨¬D) Round1 Round2 Round3 Round4 A – 01234567 B – 89abcdef C – fedcba98 D – 76543210 M0 – 54686579 M1 – 20617265 M2 – 20646574 M3 – 65726D69 M4 – 6E697374 M5 – 69638000 M6 – 00000000 M7 – 00000000 M8 – 00000000 M9 – 00000000 M10 – 00000000 M11 – 00000000 M12 – 00000000 M13 – 00000000 M14 – 00000000 M15 – 000000B0
  • 25. 25 MD5 F, G, H and I functions F(B, C, D) = (B∧C)∨(¬B∧D) G(B, C, D) = (B∧D)∨(C∧¬D) H(B, C, D) =B⊕C⊕D I(B, C, D) = C⊕(B∨¬D) F (89abcdef, fedcba98, 76543210) = (89abcdef AND fedcba98) OR (NOT-89abcdef AND 76543210) F(B, C, D) = 88888888 OR 76543210 = fedcba98 Modular Addition  (X + Y) mod Z X01234567 Yfedcba98 Z100000000 (232) (X + Y) mod Z = (01234567 + fedcba98) mod 100000000 = ffffffff mod 100000000 = ffffffff
  • 26. 26 MD5 F, G, H and I functions F(B, C, D) = (B∧C)∨(¬B∧D) G(B, C, D) = (B∧D)∨(C∧¬D) H(B, C, D) =B⊕C⊕D I(B, C, D) = C⊕(B∨¬D) F (89abcdef, fedcba98, 76543210) = (89abcdef AND fedcba98) OR (NOT-89abcdef AND 76543210) F(B, C, D) = 88888888 OR 76543210 = fedcba98 Modular Addition  ffffffff (X + Y) mod Z X  M0 = 54686579 Y ffffffff Z100000000 (232) (X + Y) mod Z = (54686579 + ffffffff) mod 100000000 = 154686578
  • 27. 27 MD5 F, G, H and I functions F(B, C, D) = (B∧C)∨(¬B∧D) G(B, C, D) = (B∧D)∨(C∧¬D) H(B, C, D) =B⊕C⊕D I(B, C, D) = C⊕(B∨¬D) F (89abcdef, fedcba98, 76543210) = (89abcdef AND fedcba98) OR (NOT-89abcdef AND 76543210) F(B, C, D) = 88888888 OR 76543210 = fedcba98 Modular Addition  154686578 (X + Y) mod Z X  K0 = d76aa478 Y 154686578 Z100000000 (232) (X + Y) mod Z = (d76aa478 + 54686578) mod 100000000 = 2bd309f0
  • 28. 28 The values for K are is derived from the formula K1 – D76AA478 K2 – E8C7B756 K3 – 242070DB K4 – C1BDCEEE K5 – F57COFA K6 – 4787C62A K7 – A8304613 K8 – FD469501 K9 – 698098D8 K10 – 8B44F7AF K11 – FFFF5BB1 K12 – 895CD7BE K13 – 6B901122 K14 – FD987193 K15 – A679438E K16 – 49B40821 K17 – F61E2562 K18 – C040B340 K19 – 265E5A51 K20 – E9B6C7AA K21 – D62F105D K22 – 02441453 K23 – D8A1E681 K24 – E7D3FBC8 K25 – 21E1CDE6 K26 – C33707D6 K27 – F4D50D87 K28 – 455A14ED K29 – A9E3E905 K30 – FCEFA3F8 K31 – 676F02D9 K32 – 8D2A4C8A K33 – FFFA3942 K34 – 8771F681 K35 – 699D6122 K36 – FDE5380C K37– A4BEEA44 K38 – 4BDECFA9 K39 – F6BB4B60 K40 – BEBFBC70 K41 – 289B7EC6 K42 – EAA127FA K43 – D4EF3085 K44 – 04881D05 K45 – D9D4D039 K46 – E6DB99E5 K47 – 1FA27CF8 K48 – C4AC5665 K49 – F4292244 K50 – 432AFF97 K51 – AB9423A7 K52 – FC93A039 K53 – 655B59C3 K54 – 8F0CCC92 K55 – FFEFF47D K56 – 85845DD1 K57 – 6FA87E4F K58 – FE2CE6E0 K59 – A3014314 K60 – 4E0811A1 K61 – F7537E82 K62 – BD3AF235 K63 – 2AD7D2BB K64 – EB86D391 MD5 F, G, H and I functions F(B, C, D) = (B∧C)∨(¬B∧D) G(B, C, D) = (B∧D)∨(C∧¬D) H(B, C, D) =B⊕C⊕D I(B, C, D) = C⊕(B∨¬D) Round1 Round2 Round3 Round4
  • 29. 29 MD5 F, G, H and I functions F(B, C, D) = (B∧C)∨(¬B∧D) G(B, C, D) = (B∧D)∨(C∧¬D) H(B, C, D) =B⊕C⊕D I(B, C, D) = C⊕(B∨¬D) F (89abcdef, fedcba98, 76543210) = (89abcdef AND fedcba98) OR (NOT-89abcdef AND 76543210) F(B, C, D) = 88888888 OR 76543210 = fedcba98 Modular Addition  2bd309f0 Left bit shift 0010 1011 1101 0011 0000 1001 1111 0000
  • 30. 001 0101 1110 1001 1000 0100 1111 1000 0xxx xxxx Shift 7 bits left 1110 1001 1000 0100 1111 1000 0001 0101 In hexa e984f815 A – 01234567 B – 89abcdef C – fedcba98 D – 76543210 (X + Y) mod Z X  B = 89abcdef Y e984f815 Z100000000 (232) (X + Y) mod Z = (89abcdef + e984f895) mod 100000000 = 7330C604 A – 76543210 B – 7330c604 C – 89abcdef D – fedcba98 2bd309f0 First operation in Round1 is completed Similarly do other 63 operations and generate the final Message Digest of 128 bits