際際滷

際際滷Share a Scribd company logo
MD5
Message Digest
Algorithm
KHAWAJA ROKHAM TARIQ
C O M P U T E R S C I E N C E D E P A R T M E N T
U N V E R S I T Y O F K O T L I A Z A D A N D J A M M U K A S H M I R
Content
Introduction
Hashing knowledge
MD5 Algorithm Structure
Implementation Steps
Performance
MD5 vs. SHA
Hashing knowledge
It is a mathematical function that convert a numerical values into another compressed
numerical values.
Output will always of fixed length.
Same message have same particular
same output.
Introduction
MD5 algorithm was developed by Professor Ronald L. Rivest in 1991. MD5 message-digest
algorithm takes as input a message of arbitrary length and produces as output a 128-bit
"fingerprint" or "message digest" of the input.
The MD5 algorithm is intended for digital signature applications, where a large file must be
"compressed" in a secure manner before being encrypted with a private (secret) key under a
public-key cryptosystem such as RSA.
MD5
Original message Add padding
Original message Add padding Add length
512 bits
blocks
512 bits
blocks
Implementation Steps
Step1 Append padding bits
The input message is "padded" (extended) so that its length (in bits) equals to 448 mod 512.
Padding is always performed, even if the length of the message is already 448 mod 512.
Padding is performed as follows: a single "1" bit is appended to the message, and then "0" bits
are appended so that the length in bits of the padded message becomes congruent to 448 mod
512. At least one bit and at most 512 bits are appended.
Padding is done such that the total length is 64bit < exact multiple of 512.
Suppose original message is 1000bit.
Now check exact multiple of 512
Total 1000bits
512*2=1024 which is not good.
512*3=1536
Now sub 64 from 1536
1536-64=1472
We need to add 472 bits more for calculation.
Also 1472 is 64bit less than exact multiple of 512.
Append the original length before padding.
We use modulus 64 operation.
Get exact multiple of 512 after 64 bits adding.
Now create blocks according to bit length.
Before padding 1000bits.
Now apply mod64.
1000] length 264
Implementation Steps
Step2. Append length
A 64-bit representation of the length of the message is appended to the result of step1. If the
length of the message is greater than 2^64, only the low-order 64 bits will be used.
The resulting message (after padding with bits and with b) has a length that is an exact multiple
of 512 bits. The input message will have a length that is an exact multiple of 16 (32-bit) words.
Processing blocks
Copy 4-chaining blocks into small corresponding variables.
Dividing 512 bit block into 16(32bits blocks)
Apply four rounds.
16 sub blocks Constant (t)
One round
a b c d
Implementation Steps
Step3. Initialize MD buffer
A four-word buffer (A, B, C, D) is used to compute the message digest. Each of
A, B, C, D is a 32-bit register. These registers are initialized to the following values
in hexadecimal, low-order bytes first):
word A: 01 23 45 67
word B: 89 ab cd ef
word C: fe dc ba 98
word D: 76 54 32 10
Intinliaze 4-Chaining varbles
32 bits
Name A,B,C,D.
Values in hexadecimal.
Implementation Steps
Step4. Process message in 16-word blocks
Four functions will be defined such that each function takes an input of three
32-bit words and produces a 32-bit word output.
F (X, Y, Z) = XY or not (X) Z
G (X, Y, Z) = XZ or Y not (Z)
H (X, Y, Z) = X xor Y xor Z
I (X, Y, Z) = Y xor (X or not (Z))
Implementation Steps
Round 1.
[abcd k s i] denote the operation a = b + ((a + F (b, c, d) + X [k] + T [i]) <<< s).
Do the following 16 operations.
[ABCD 0 7 1] [DABC 1 12 2] [CDAB 2 17 3] [BCDA 3 22 4]
[ABCD 4 7 5] [DABC 5 12 6] [CDAB 6 17 7] [BCDA 7 22 8]
[ABCD 8 7 9] [DABC 9 12 10] [CDAB 10 17 11] [BCDA 11 22 12]
[ABCD 12 7 13] [DABC 13 12 14] [CDAB 14 17 15] [BCDA 15 22 16]
Single MD5 operation mathmeticaly defined like this:
a=b+((a+process,p(b,c,d)+M[i]+T[k]))<<shift
M[i]=message is i.
T[k]=constant is k.
<<shift=circular shift

More Related Content

What's hot (20)

Hash function
Hash functionHash function
Hash function
Harry Potter
Hash Function
Hash FunctionHash Function
Hash Function
stalin rijal
Data encryption standard
Data encryption standardData encryption standard
Data encryption standard
Vasuki Ramasamy
5. message authentication and hash function
5. message authentication and hash function5. message authentication and hash function
5. message authentication and hash function
Chirag Patel
SHA- Secure hashing algorithm
SHA- Secure hashing algorithmSHA- Secure hashing algorithm
SHA- Secure hashing algorithm
Ruchi Maurya
Encryption And Decryption Using AES Algorithm
Encryption And Decryption Using AES AlgorithmEncryption And Decryption Using AES Algorithm
Encryption And Decryption Using AES Algorithm
Ahmed Raza Shaikh
Hash Function
Hash FunctionHash Function
Hash Function
Siddharth Srivastava
Trible data encryption standard (3DES)
Trible data encryption standard (3DES)Trible data encryption standard (3DES)
Trible data encryption standard (3DES)
Ahmed Mohamed Mahmoud
PGP S/MIME
PGP S/MIMEPGP S/MIME
PGP S/MIME
Sou Jana
Message Authentication Code & HMAC
Message Authentication Code & HMACMessage Authentication Code & HMAC
Message Authentication Code & HMAC
Krishna Gehlot
Symmetric encryption
Symmetric encryptionSymmetric encryption
Symmetric encryption
DR RICHMOND ADEBIAYE
Hash function
Hash function Hash function
Hash function
Salman Memon
RSA ALGORITHM
RSA ALGORITHMRSA ALGORITHM
RSA ALGORITHM
Dr. Shashank Shetty
DES
DESDES
DES
Naga Srimanyu Timmaraju
Network security cryptographic hash function
Network security  cryptographic hash functionNetwork security  cryptographic hash function
Network security cryptographic hash function
Mijanur Rahman Milon
Idea(international data encryption algorithm)
Idea(international data encryption algorithm)Idea(international data encryption algorithm)
Idea(international data encryption algorithm)
SAurabh PRajapati
Des
DesDes
Des
Anshul Sharma
Secure Hash Algorithm
Secure Hash AlgorithmSecure Hash Algorithm
Secure Hash Algorithm
Vishakha Agarwal
DES (Data Encryption Standard) pressentation
DES (Data Encryption Standard) pressentationDES (Data Encryption Standard) pressentation
DES (Data Encryption Standard) pressentation
sarhadisoftengg
Diffie hellman key exchange algorithm
Diffie hellman key exchange algorithmDiffie hellman key exchange algorithm
Diffie hellman key exchange algorithm
Sunita Kharayat
Data encryption standard
Data encryption standardData encryption standard
Data encryption standard
Vasuki Ramasamy
5. message authentication and hash function
5. message authentication and hash function5. message authentication and hash function
5. message authentication and hash function
Chirag Patel
SHA- Secure hashing algorithm
SHA- Secure hashing algorithmSHA- Secure hashing algorithm
SHA- Secure hashing algorithm
Ruchi Maurya
Encryption And Decryption Using AES Algorithm
Encryption And Decryption Using AES AlgorithmEncryption And Decryption Using AES Algorithm
Encryption And Decryption Using AES Algorithm
Ahmed Raza Shaikh
Trible data encryption standard (3DES)
Trible data encryption standard (3DES)Trible data encryption standard (3DES)
Trible data encryption standard (3DES)
Ahmed Mohamed Mahmoud
PGP S/MIME
PGP S/MIMEPGP S/MIME
PGP S/MIME
Sou Jana
Message Authentication Code & HMAC
Message Authentication Code & HMACMessage Authentication Code & HMAC
Message Authentication Code & HMAC
Krishna Gehlot
Network security cryptographic hash function
Network security  cryptographic hash functionNetwork security  cryptographic hash function
Network security cryptographic hash function
Mijanur Rahman Milon
Idea(international data encryption algorithm)
Idea(international data encryption algorithm)Idea(international data encryption algorithm)
Idea(international data encryption algorithm)
SAurabh PRajapati
DES (Data Encryption Standard) pressentation
DES (Data Encryption Standard) pressentationDES (Data Encryption Standard) pressentation
DES (Data Encryption Standard) pressentation
sarhadisoftengg
Diffie hellman key exchange algorithm
Diffie hellman key exchange algorithmDiffie hellman key exchange algorithm
Diffie hellman key exchange algorithm
Sunita Kharayat

Similar to MD5 (20)

ENGG_CSE_III_YEAR_Message_Digest_MD_5.ppt
ENGG_CSE_III_YEAR_Message_Digest_MD_5.pptENGG_CSE_III_YEAR_Message_Digest_MD_5.ppt
ENGG_CSE_III_YEAR_Message_Digest_MD_5.ppt
SakethBhargavaRallap
introduction to MD5 Massage Digest Algorithm.ppt
introduction to MD5 Massage Digest Algorithm.pptintroduction to MD5 Massage Digest Algorithm.ppt
introduction to MD5 Massage Digest Algorithm.ppt
madlord2
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
Fraboni Ec
Hash& mac algorithms
Hash& mac algorithmsHash& mac algorithms
Hash& mac algorithms
Harry Potter
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
Luis Goldster
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
James Wong
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
Young Alista
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
David Hoen
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
Tony Nguyen
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
Sourav Punoriyar
MD5.pptx.pdf
MD5.pptx.pdfMD5.pptx.pdf
MD5.pptx.pdf
PrateekKarkera1
Unit-3.pdf
Unit-3.pdfUnit-3.pdf
Unit-3.pdf
HarishChaudhary21
Data streaming algorithms
Data streaming algorithmsData streaming algorithms
Data streaming algorithms
Hridyesh Bisht
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 錚
MD5 ALGORITHM.pptx
MD5 ALGORITHM.pptxMD5 ALGORITHM.pptx
MD5 ALGORITHM.pptx
Rajapriya82
Cryptographic Hash Functions in Security.pptx
Cryptographic Hash Functions in Security.pptxCryptographic Hash Functions in Security.pptx
Cryptographic Hash Functions in Security.pptx
VivekanandaGN1
Message Digest Algorithm 4 cryptography.pptx
Message Digest Algorithm 4 cryptography.pptxMessage Digest Algorithm 4 cryptography.pptx
Message Digest Algorithm 4 cryptography.pptx
mchod4461
Secure hashing algorithm
Secure hashing algorithmSecure hashing algorithm
Secure hashing algorithm
Karteek Paruchuri
SHA
SHASHA
SHA
SubashiniRathinavel
MD5 - Hash Functions & RIPEMD160
MD5 - Hash Functions & RIPEMD160MD5 - Hash Functions & RIPEMD160
MD5 - Hash Functions & RIPEMD160
chuxuantinh
ENGG_CSE_III_YEAR_Message_Digest_MD_5.ppt
ENGG_CSE_III_YEAR_Message_Digest_MD_5.pptENGG_CSE_III_YEAR_Message_Digest_MD_5.ppt
ENGG_CSE_III_YEAR_Message_Digest_MD_5.ppt
SakethBhargavaRallap
introduction to MD5 Massage Digest Algorithm.ppt
introduction to MD5 Massage Digest Algorithm.pptintroduction to MD5 Massage Digest Algorithm.ppt
introduction to MD5 Massage Digest Algorithm.ppt
madlord2
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
Fraboni Ec
Hash& mac algorithms
Hash& mac algorithmsHash& mac algorithms
Hash& mac algorithms
Harry Potter
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
Luis Goldster
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
James Wong
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
Young Alista
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
David Hoen
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
Tony Nguyen
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
Sourav Punoriyar
Data streaming algorithms
Data streaming algorithmsData streaming algorithms
Data streaming algorithms
Hridyesh Bisht
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 錚
MD5 ALGORITHM.pptx
MD5 ALGORITHM.pptxMD5 ALGORITHM.pptx
MD5 ALGORITHM.pptx
Rajapriya82
Cryptographic Hash Functions in Security.pptx
Cryptographic Hash Functions in Security.pptxCryptographic Hash Functions in Security.pptx
Cryptographic Hash Functions in Security.pptx
VivekanandaGN1
Message Digest Algorithm 4 cryptography.pptx
Message Digest Algorithm 4 cryptography.pptxMessage Digest Algorithm 4 cryptography.pptx
Message Digest Algorithm 4 cryptography.pptx
mchod4461
MD5 - Hash Functions & RIPEMD160
MD5 - Hash Functions & RIPEMD160MD5 - Hash Functions & RIPEMD160
MD5 - Hash Functions & RIPEMD160
chuxuantinh

Recently uploaded (20)

EV_Charging_Prediction_Presentation.pptx
EV_Charging_Prediction_Presentation.pptxEV_Charging_Prediction_Presentation.pptx
EV_Charging_Prediction_Presentation.pptx
SidramappaB
The Asia- Pacific Islands Rural Advisory Services
The Asia- Pacific Islands Rural Advisory ServicesThe Asia- Pacific Islands Rural Advisory Services
The Asia- Pacific Islands Rural Advisory Services
Francois Stepman
Brazil: promoting participatory plant breeding through the establishment of a...
Brazil: promoting participatory plant breeding through the establishment of a...Brazil: promoting participatory plant breeding through the establishment of a...
Brazil: promoting participatory plant breeding through the establishment of a...
Francois Stepman
Causes and prevention of perinatal mortality rate.pptx
Causes and prevention of perinatal mortality rate.pptxCauses and prevention of perinatal mortality rate.pptx
Causes and prevention of perinatal mortality rate.pptx
BenTennyson31
The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...
The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...
The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...
Francois Stepman
Agroecology based research & innovation for food system transitions
Agroecology based research & innovation for food system transitionsAgroecology based research & innovation for food system transitions
Agroecology based research & innovation for food system transitions
Francois Stepman
1. Critical thinking to write down .pptx
1. Critical thinking to write down .pptx1. Critical thinking to write down .pptx
1. Critical thinking to write down .pptx
hibahassan160702
ScreenHunter pro crack with serial free Download 2025
ScreenHunter pro crack with serial free Download 2025ScreenHunter pro crack with serial free Download 2025
ScreenHunter pro crack with serial free Download 2025
nidah52605
Warman Robot Challenge Project Plan.pptx
Warman Robot Challenge Project Plan.pptxWarman Robot Challenge Project Plan.pptx
Warman Robot Challenge Project Plan.pptx
AvikBhattacharya25
EU R&I landscape and its instruments (relevance, success, limits)
EU R&I landscape and its instruments (relevance, success, limits)EU R&I landscape and its instruments (relevance, success, limits)
EU R&I landscape and its instruments (relevance, success, limits)
Francois Stepman
Updated treatment of hypothyroidism ,diagnosis
Updated treatment of hypothyroidism ,diagnosisUpdated treatment of hypothyroidism ,diagnosis
Updated treatment of hypothyroidism ,diagnosis
Mohammed Ahmed Bamashmos
THE ROLE OF COMMUNICATION IN WORKPLACE.pdf
THE ROLE OF COMMUNICATION IN WORKPLACE.pdfTHE ROLE OF COMMUNICATION IN WORKPLACE.pdf
THE ROLE OF COMMUNICATION IN WORKPLACE.pdf
gbbsmart
Ciwara Capital: Innovative fund owned and managed by Africans living in Europ...
Ciwara Capital: Innovative fund owned and managed by Africans living in Europ...Ciwara Capital: Innovative fund owned and managed by Africans living in Europ...
Ciwara Capital: Innovative fund owned and managed by Africans living in Europ...
Francois Stepman
Biography of Bradley Liebe
Biography of Bradley LiebeBiography of Bradley Liebe
Biography of Bradley Liebe
Bradley Liebe
Research Survey Practical research seinor highschool
Research Survey Practical research seinor highschoolResearch Survey Practical research seinor highschool
Research Survey Practical research seinor highschool
gamershadow621
PMO 際際滷s for Process Improvement in all environments
PMO 際際滷s for Process Improvement in all environmentsPMO 際際滷s for Process Improvement in all environments
PMO 際際滷s for Process Improvement in all environments
Annamalai Ramanathan
Supporting innovations at scale through relevant funding mechanisms and markets
Supporting innovations at scale through relevant funding mechanisms and marketsSupporting innovations at scale through relevant funding mechanisms and markets
Supporting innovations at scale through relevant funding mechanisms and markets
Francois Stepman
History, diversity, and social class mmm
History, diversity, and social class mmmHistory, diversity, and social class mmm
History, diversity, and social class mmm
MarhamahRazak1
Exploring Agroecological Principles in Practice: Preliminary Survey Results f...
Exploring Agroecological Principles in Practice: Preliminary Survey Results f...Exploring Agroecological Principles in Practice: Preliminary Survey Results f...
Exploring Agroecological Principles in Practice: Preliminary Survey Results f...
Francois Stepman
early registration initiatives for 2025.pptx
early registration initiatives for 2025.pptxearly registration initiatives for 2025.pptx
early registration initiatives for 2025.pptx
TeacherCJBass
EV_Charging_Prediction_Presentation.pptx
EV_Charging_Prediction_Presentation.pptxEV_Charging_Prediction_Presentation.pptx
EV_Charging_Prediction_Presentation.pptx
SidramappaB
The Asia- Pacific Islands Rural Advisory Services
The Asia- Pacific Islands Rural Advisory ServicesThe Asia- Pacific Islands Rural Advisory Services
The Asia- Pacific Islands Rural Advisory Services
Francois Stepman
Brazil: promoting participatory plant breeding through the establishment of a...
Brazil: promoting participatory plant breeding through the establishment of a...Brazil: promoting participatory plant breeding through the establishment of a...
Brazil: promoting participatory plant breeding through the establishment of a...
Francois Stepman
Causes and prevention of perinatal mortality rate.pptx
Causes and prevention of perinatal mortality rate.pptxCauses and prevention of perinatal mortality rate.pptx
Causes and prevention of perinatal mortality rate.pptx
BenTennyson31
The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...
The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...
The Global NARS Consortium (GNC) supported by: Transforming the Agri-Food Sys...
Francois Stepman
Agroecology based research & innovation for food system transitions
Agroecology based research & innovation for food system transitionsAgroecology based research & innovation for food system transitions
Agroecology based research & innovation for food system transitions
Francois Stepman
1. Critical thinking to write down .pptx
1. Critical thinking to write down .pptx1. Critical thinking to write down .pptx
1. Critical thinking to write down .pptx
hibahassan160702
ScreenHunter pro crack with serial free Download 2025
ScreenHunter pro crack with serial free Download 2025ScreenHunter pro crack with serial free Download 2025
ScreenHunter pro crack with serial free Download 2025
nidah52605
Warman Robot Challenge Project Plan.pptx
Warman Robot Challenge Project Plan.pptxWarman Robot Challenge Project Plan.pptx
Warman Robot Challenge Project Plan.pptx
AvikBhattacharya25
EU R&I landscape and its instruments (relevance, success, limits)
EU R&I landscape and its instruments (relevance, success, limits)EU R&I landscape and its instruments (relevance, success, limits)
EU R&I landscape and its instruments (relevance, success, limits)
Francois Stepman
Updated treatment of hypothyroidism ,diagnosis
Updated treatment of hypothyroidism ,diagnosisUpdated treatment of hypothyroidism ,diagnosis
Updated treatment of hypothyroidism ,diagnosis
Mohammed Ahmed Bamashmos
THE ROLE OF COMMUNICATION IN WORKPLACE.pdf
THE ROLE OF COMMUNICATION IN WORKPLACE.pdfTHE ROLE OF COMMUNICATION IN WORKPLACE.pdf
THE ROLE OF COMMUNICATION IN WORKPLACE.pdf
gbbsmart
Ciwara Capital: Innovative fund owned and managed by Africans living in Europ...
Ciwara Capital: Innovative fund owned and managed by Africans living in Europ...Ciwara Capital: Innovative fund owned and managed by Africans living in Europ...
Ciwara Capital: Innovative fund owned and managed by Africans living in Europ...
Francois Stepman
Biography of Bradley Liebe
Biography of Bradley LiebeBiography of Bradley Liebe
Biography of Bradley Liebe
Bradley Liebe
Research Survey Practical research seinor highschool
Research Survey Practical research seinor highschoolResearch Survey Practical research seinor highschool
Research Survey Practical research seinor highschool
gamershadow621
PMO 際際滷s for Process Improvement in all environments
PMO 際際滷s for Process Improvement in all environmentsPMO 際際滷s for Process Improvement in all environments
PMO 際際滷s for Process Improvement in all environments
Annamalai Ramanathan
Supporting innovations at scale through relevant funding mechanisms and markets
Supporting innovations at scale through relevant funding mechanisms and marketsSupporting innovations at scale through relevant funding mechanisms and markets
Supporting innovations at scale through relevant funding mechanisms and markets
Francois Stepman
History, diversity, and social class mmm
History, diversity, and social class mmmHistory, diversity, and social class mmm
History, diversity, and social class mmm
MarhamahRazak1
Exploring Agroecological Principles in Practice: Preliminary Survey Results f...
Exploring Agroecological Principles in Practice: Preliminary Survey Results f...Exploring Agroecological Principles in Practice: Preliminary Survey Results f...
Exploring Agroecological Principles in Practice: Preliminary Survey Results f...
Francois Stepman
early registration initiatives for 2025.pptx
early registration initiatives for 2025.pptxearly registration initiatives for 2025.pptx
early registration initiatives for 2025.pptx
TeacherCJBass

MD5

  • 1. MD5 Message Digest Algorithm KHAWAJA ROKHAM TARIQ C O M P U T E R S C I E N C E D E P A R T M E N T U N V E R S I T Y O F K O T L I A Z A D A N D J A M M U K A S H M I R
  • 2. Content Introduction Hashing knowledge MD5 Algorithm Structure Implementation Steps Performance MD5 vs. SHA
  • 3. Hashing knowledge It is a mathematical function that convert a numerical values into another compressed numerical values. Output will always of fixed length. Same message have same particular same output.
  • 4. Introduction MD5 algorithm was developed by Professor Ronald L. Rivest in 1991. MD5 message-digest algorithm takes as input a message of arbitrary length and produces as output a 128-bit "fingerprint" or "message digest" of the input. The MD5 algorithm is intended for digital signature applications, where a large file must be "compressed" in a secure manner before being encrypted with a private (secret) key under a public-key cryptosystem such as RSA.
  • 6. Original message Add padding Original message Add padding Add length 512 bits blocks 512 bits blocks
  • 7. Implementation Steps Step1 Append padding bits The input message is "padded" (extended) so that its length (in bits) equals to 448 mod 512. Padding is always performed, even if the length of the message is already 448 mod 512. Padding is performed as follows: a single "1" bit is appended to the message, and then "0" bits are appended so that the length in bits of the padded message becomes congruent to 448 mod 512. At least one bit and at most 512 bits are appended.
  • 8. Padding is done such that the total length is 64bit < exact multiple of 512. Suppose original message is 1000bit. Now check exact multiple of 512 Total 1000bits 512*2=1024 which is not good. 512*3=1536 Now sub 64 from 1536 1536-64=1472 We need to add 472 bits more for calculation. Also 1472 is 64bit less than exact multiple of 512.
  • 9. Append the original length before padding. We use modulus 64 operation. Get exact multiple of 512 after 64 bits adding. Now create blocks according to bit length. Before padding 1000bits. Now apply mod64. 1000] length 264
  • 10. Implementation Steps Step2. Append length A 64-bit representation of the length of the message is appended to the result of step1. If the length of the message is greater than 2^64, only the low-order 64 bits will be used. The resulting message (after padding with bits and with b) has a length that is an exact multiple of 512 bits. The input message will have a length that is an exact multiple of 16 (32-bit) words.
  • 11. Processing blocks Copy 4-chaining blocks into small corresponding variables. Dividing 512 bit block into 16(32bits blocks) Apply four rounds. 16 sub blocks Constant (t) One round a b c d
  • 12. Implementation Steps Step3. Initialize MD buffer A four-word buffer (A, B, C, D) is used to compute the message digest. Each of A, B, C, D is a 32-bit register. These registers are initialized to the following values in hexadecimal, low-order bytes first): word A: 01 23 45 67 word B: 89 ab cd ef word C: fe dc ba 98 word D: 76 54 32 10
  • 13. Intinliaze 4-Chaining varbles 32 bits Name A,B,C,D. Values in hexadecimal.
  • 14. Implementation Steps Step4. Process message in 16-word blocks Four functions will be defined such that each function takes an input of three 32-bit words and produces a 32-bit word output. F (X, Y, Z) = XY or not (X) Z G (X, Y, Z) = XZ or Y not (Z) H (X, Y, Z) = X xor Y xor Z I (X, Y, Z) = Y xor (X or not (Z))
  • 15. Implementation Steps Round 1. [abcd k s i] denote the operation a = b + ((a + F (b, c, d) + X [k] + T [i]) <<< s). Do the following 16 operations. [ABCD 0 7 1] [DABC 1 12 2] [CDAB 2 17 3] [BCDA 3 22 4] [ABCD 4 7 5] [DABC 5 12 6] [CDAB 6 17 7] [BCDA 7 22 8] [ABCD 8 7 9] [DABC 9 12 10] [CDAB 10 17 11] [BCDA 11 22 12] [ABCD 12 7 13] [DABC 13 12 14] [CDAB 14 17 15] [BCDA 15 22 16]
  • 16. Single MD5 operation mathmeticaly defined like this: a=b+((a+process,p(b,c,d)+M[i]+T[k]))<<shift M[i]=message is i. T[k]=constant is k. <<shift=circular shift

Editor's Notes

  • #5: Arbitrary khudmukhtari.
  • #12: 32 32 k 16 blocks m divide.