SlideShare a Scribd company logo
Prof. Rupesh G. Vaishnav
rupesh.vaishnav@darshan.ac.in
94280-37452
Information & Network Security (2170709) Darshan Institute of Engineering & Technology
UNIT-5
Cryptographic
Hash
Functions
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 2
Outline
 Cryptographic Hash Functions
 Applications
 Simple hash functions
 Requirements and security
 Hash functions based on Cipher Block Chaining
 Secure Hash Algorithm (SHA)
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 3
Hash Function
 A hash function H accepts a
variable-length block of data M
as input and produces a fixed-
size hash value h = H(M).
 A “good” hash function has the
property that the results of
applying a change to any bit or
bits in M results, with high
probability, in a change to the
hash code.
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 4
Applications of Cryptographic Hash Functions
1. Message authentication
2. Digital Signature
3. One-way password file
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 5
1. Message Authentication
 Message authentication is a mechanism or service used to verify
the integrity of a message.
 Message authentication assures that data received are exactly as
sent (i.e., contain no modification, insertion, deletion, or replay).
 When a hash function is used to provide message authentication,
the hash function value is often referred to as a message digest.
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 6
Message authentication method - 1
 Only A and B share the secret key, the message must have come
from A and has not been altered.
 The hash code provides the structure required to achieve
authentication.
 Because encryption is applied to the entire message plus hash
code, confidentiality is also provided.
E D
ll
H
H
M M
K K
H(M)
Compare
E (K, [ M || H(M)])
Source A Destination B
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 7
Message authentication method - 2
 Only the hash code is encrypted, using symmetric encryption.
 This reduces the processing burden for those applications that do
not require confidentiality.
H
M
Source A Destination B
E
K
ll M
E(K, H(M))
H
D
K Compare
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 8
Message authentication method - 3
 It is possible to use a hash function but no encryption for message
authentication.
 A and B share a common secret value S.
 A computes the hash value over the concatenation of M and S
and appends the resulting hash value to M.
 Because B possesses S, it can recompute the hash value to verify.
 An opponent cannot modify an intercepted message.
M
Source A Destination B
H
ll M
H(M || S)
H
Compare
ll
S
ll
S
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 9
Message authentication method - 4
 Confidentiality can be added to the approach of method (3) by
encrypting the entire message plus the hash code.
M
Source A Destination B
H
ll M
H(M || S)
H
Compare
ll
S
ll
S
E
K
D
K
E (K, [ M || H(M || S)])
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 10
MAC (Message Authentication Code)
 More commonly, message authentication is achieved using a MAC
also known as keyed hash function.
 MACs are used between two parties that share a secret key to
authenticate information exchanged between those parties.
 A MAC function takes as input a secret key and a data block and
produces a hash value, referred to as the MAC.
 The combination of hashing and encryption results in an overall
function that is, in fact, a MAC (Method -2 in previous slide).
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 11
Digital Signature
 A digital signature is a mathematical technique used to validate
the authenticity and integrity of a message, software or digital
document.
 The operation of the digital signature is similar to that of the MAC.
 In the case of the digital signature, the hash value of a message is
encrypted with a user’s private key.
 Anyone who knows the user’s public key can verify the integrity of
the message that is associated with the digital signature.
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 12
Digital Signature method - 1
 The hash code is encrypted, using public-key encryption with the
sender’s private key.
 This provides authentication.
 It also provides a digital signature, because only the sender could
have produced the encrypted hash code.
H
M
Source A Destination B
E
PRa
ll M
E(PRa, H(M))
H
D
PUa Compare
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 13
Digital Signature method - 2
 If confidentiality as well as a digital signature is desired, then the
message plus the private-key-encrypted hash code can be
encrypted using a symmetric secret key.
M
Source A Destination B
E
ll M
E(Pra, H(M))
H
Compare
E
K
D
K
E (K, [ M || E(Pra, H(M)])
H
PRa
D
PUa
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 14
Security Requirements
1. Disclosure
2. Traffic analysis
3. Masquerade
4. Content modification
5. Sequence modification
6. Timing modification
7. Source repudiation
8. Destination repudiation
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 15
Requirements for hash functions
1. Can be applied to any sized message M.
2. Produces fixed-length output h.
3. It is easy to compute h=H(M) for any message M.
4. Given hash value h is infeasible to find y such that (H(y) = h)
• One-way property
5. For given block x, it is computational infeasible to find
y ≠ x with H(y) = H(x)
• Weak collision resistance
6. It is computationally infeasible to find messages m1 and m2 with
H(m1) = H(m2)
• Strong collision resistance
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 16
Simple Hash Function
 The input (message, file, etc.) is viewed as a sequence of n-bit blocks.
 The input is processed one block at a time in an iterative fashion to produce
an n-bit hash function.
 One of the simplest hash functions is the bit-by-bit exclusive-OR (XOR) of
every block.
Where,
= ith
bit of the hash code 1 ≤ i ≤ n
m = number of n-bit blocks in the input
= ith
bit in jth
block
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 17
SHA - Secure Hash Algorithm
SHA - 1 SHA - 224 SHA - 256 SHA - 384 SHA - 512
Message
Digest Size
160 224 256 384 512
Message Size < 264
< 264
< 264
< 2128
< 2128
Block Size 512 512 512 1024 1024
Word Size 32 32 32 64 64
Number of
Steps 80 64 64 80 80
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 18
SHA - 512
 The algorithm takes as input a message with a maximum length of
less than 2128
bits and produces as output a 512-bit message
digest.
 The input is processed in 1024-bit blocks.
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 20
Message (L bit) 10000…0 L
M1 (1024 bits) M2 (1024 bits) MN (1024 bits)
F
+
H1 (512
bits)
IV=H0
F
+
H2 (512
bits)
F
+
HN (512
bits)
Message Digest Generation using SHA -512
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 21
Step -1 Append Padding Bits
 The message is padded so that its length is congruent to 896
modulo 1024 [length ≡ 896(mod 1024)] .
 Padding is always added, even if the message is already of the
desired length.
 Thus, the number of padding bits is in the range of 1 to 1024.
 The padding consists of a single 1 bit followed by the necessary
number of 0 bits.
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 22
Step -2 Append Length
 A block of 128 bits is appended to the message.
 This block is treated as an unsigned 128-bit integer (most
significant byte first) and contains the length of the original
message (before the padding).
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 23
Step -3 Initialize hash buffer
 The outcome of the first two steps produces a message that is an
integer multiple of 1024 bits in length.
 the expanded message is represented as the sequence of 1024-bit
blocks M1 , M2, … , MN, so that the total length of expanded
message is N X 1024 bits.
 A 512-bit buffer is used to hold intermediate and final results of
the hash function. The buffer can be represented as eight 64-bit
registers (a, b, c, d, e, f, g, h).
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 24
Step -4 Process message in 1024-bit (128-word) blocks
 The heart of the algorithm is a module that consists of 80 rounds;
this module is labelled F
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 26
SHA-512 Processing of a Single 1024-Bit Block
Message
schedule
Mi Hi-1
a b c d e f g e 64
Round 0
K0
a b c d e f g e 64
Round 79
K79
W0
W79
+ + + + + + + +
Hi
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 27
SHA-512 Processing of a Single 1024-Bit Block
 Each round takes as input the 512-bit buffer value, abcdefgh, and
updates the contents of the buffer.
 At input to the first round, the buffer has the value of the
intermediate hash value, Hi-1.
 Each round t makes use of a 64-bit value Wt, derived from the
current 1024-bit block being processed.
 The output of the eightieth round is added to the input to the first
round (Hi-1) to produce Hi.
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 28
Step – 5 Output
 After all N 1024-bit blocks have been processed, the output from
the Nth stage is the 512-bit message digest
SHA-512 Round Function
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 30
SHA-512 Round Function – Cont…
a b c d e f g h
b c d e f g h
a
Ʃ
+
+
Maj
+
Ʃ
Ch +
+
+ Wt
+ Kt
𝑇 1=h+Ch(𝑒 , 𝑓 , 𝑔)+
(∑
1
512
𝑒
)+𝑊𝑡 + 𝐾𝑡
𝑇 2=(∑
0
512
𝑎)+Maj (𝑎 , 𝑏 ,𝑐 )
Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 32
SHA-512 Round Function Elements
 Maj(a,b,c) = (a AND b) XOR (a AND c) XOR (b AND c) Majority of
arguments are true
 ∑(a) = ROTR(a,28) XOR ROTR(a,34) XOR ROTR(a,39)
 ∑(e) = ROTR(e,14) XOR ROTR(e,18) XOR ROTR(e,41)
 + = addition modulo 264
 Kt = a 64-bit additive constant
 Wt = a 64-bit word derived from the current 512-bit input block.
Cryptographic Hash Functions in Security.pptx

More Related Content

PPTX
Cryptographic hash function md5
PDF
IRJET - Hash Functions and its Security for Snags
PPT
Hash mac algorithms
PPT
Hash mac algorithms
PPT
Hash mac algorithms
PPT
Hash mac algorithms
PPT
Hash mac algorithms
PPT
Hash mac algorithms
Cryptographic hash function md5
IRJET - Hash Functions and its Security for Snags
Hash mac algorithms
Hash mac algorithms
Hash mac algorithms
Hash mac algorithms
Hash mac algorithms
Hash mac algorithms

Similar to Cryptographic Hash Functions in Security.pptx (20)

PPT
Hash& mac algorithms
PDF
Cs8792 cns - unit iv
PDF
Cs8792 cns - unit iv
DOCX
Cryptography and netwrk securityunit 4
PPTX
2.15 Message Authentication Code and Hash Functions.pptx
PPTX
Message Authentication Codes in Security.pptx
PPTX
cryptography and network security cns.pptx
PDF
A Comparative Analysis between SHA and MD5 algorithms
DOCX
Cryptography and Network Security Principles and Practice.docx
PDF
lecture13.pdf
PDF
Cns
PPT
Cryptography and Message Authentication NS3
PDF
Message Authentication and Hash Function.pdf
PPT
Hash crypto
PPT
Hash crypto
PPT
Hash crypto
PPT
Hash crypto
PPT
Hash crypto
PPT
Hash crypto
PPT
Hash crypto
Hash& mac algorithms
Cs8792 cns - unit iv
Cs8792 cns - unit iv
Cryptography and netwrk securityunit 4
2.15 Message Authentication Code and Hash Functions.pptx
Message Authentication Codes in Security.pptx
cryptography and network security cns.pptx
A Comparative Analysis between SHA and MD5 algorithms
Cryptography and Network Security Principles and Practice.docx
lecture13.pdf
Cns
Cryptography and Message Authentication NS3
Message Authentication and Hash Function.pdf
Hash crypto
Hash crypto
Hash crypto
Hash crypto
Hash crypto
Hash crypto
Hash crypto
Ad

More from VivekanandaGN1 (20)

PPTX
Study_Material_Presentations_Unit-2.pptx
PPT
Classical-Problem-of-Synchronization in OS
PPTX
Web Security and its Importance in the Present era
PPT
Cost, Price, and Price for Performance.ppt
PPT
Computer performance and cost analysis in systems
PPT
Technology trends-Computer food chain technologies
PPT
Fundamentals of Computer Architecture lecture notes
PPT
Digital computer architecture issues in IO
PPT
Storage devices metrics productivity- IO Introduction
PPTX
Web security Threats and approaches in Security.pptx
PPTX
Remote User Authentication ,Symmetric, Asymmetric and Kerberos.ppt
PPTX
Key management and Distribution in Network security.ppt
PPTX
Asymmetric Ciphers in Networks and Security.pptx
PPTX
IdentityTheft by federal trade comission
PPTX
Cybercrime Mobile and Wireless Devices.pptx
PPTX
Cyber Secuirty Fully explained Lecture Notes
PPT
CYBER-CRIME PRESENTATION with real-time examples
PDF
GANS Project for Image idetification.pdf
PDF
Cheat sheet SQL commands with examples and easy understanding
PDF
Master the arrays and algorithms using Algotutor
Study_Material_Presentations_Unit-2.pptx
Classical-Problem-of-Synchronization in OS
Web Security and its Importance in the Present era
Cost, Price, and Price for Performance.ppt
Computer performance and cost analysis in systems
Technology trends-Computer food chain technologies
Fundamentals of Computer Architecture lecture notes
Digital computer architecture issues in IO
Storage devices metrics productivity- IO Introduction
Web security Threats and approaches in Security.pptx
Remote User Authentication ,Symmetric, Asymmetric and Kerberos.ppt
Key management and Distribution in Network security.ppt
Asymmetric Ciphers in Networks and Security.pptx
IdentityTheft by federal trade comission
Cybercrime Mobile and Wireless Devices.pptx
Cyber Secuirty Fully explained Lecture Notes
CYBER-CRIME PRESENTATION with real-time examples
GANS Project for Image idetification.pdf
Cheat sheet SQL commands with examples and easy understanding
Master the arrays and algorithms using Algotutor
Ad

Recently uploaded (20)

PDF
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
PPTX
Software Engineering and software moduleing
PDF
August -2025_Top10 Read_Articles_ijait.pdf
PDF
737-MAX_SRG.pdf student reference guides
PPTX
Fundamentals of Mechanical Engineering.pptx
PPTX
Module 8- Technological and Communication Skills.pptx
PDF
Visual Aids for Exploratory Data Analysis.pdf
PDF
ChapteR012372321DFGDSFGDFGDFSGDFGDFGDFGSDFGDFGFD
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PDF
Soil Improvement Techniques Note - Rabbi
PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
PDF
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PPTX
introduction to high performance computing
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PPTX
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
PPT
Total quality management ppt for engineering students
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PDF
Design Guidelines and solutions for Plastics parts
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
Software Engineering and software moduleing
August -2025_Top10 Read_Articles_ijait.pdf
737-MAX_SRG.pdf student reference guides
Fundamentals of Mechanical Engineering.pptx
Module 8- Technological and Communication Skills.pptx
Visual Aids for Exploratory Data Analysis.pdf
ChapteR012372321DFGDSFGDFGDFSGDFGDFGDFGSDFGDFGFD
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
Soil Improvement Techniques Note - Rabbi
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
introduction to high performance computing
Exploratory_Data_Analysis_Fundamentals.pdf
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
Total quality management ppt for engineering students
Fundamentals of safety and accident prevention -final (1).pptx
Design Guidelines and solutions for Plastics parts
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx

Cryptographic Hash Functions in Security.pptx

  • 1. Prof. Rupesh G. Vaishnav rupesh.vaishnav@darshan.ac.in 94280-37452 Information & Network Security (2170709) Darshan Institute of Engineering & Technology UNIT-5 Cryptographic Hash Functions
  • 2. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 2 Outline  Cryptographic Hash Functions  Applications  Simple hash functions  Requirements and security  Hash functions based on Cipher Block Chaining  Secure Hash Algorithm (SHA)
  • 3. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 3 Hash Function  A hash function H accepts a variable-length block of data M as input and produces a fixed- size hash value h = H(M).  A “good” hash function has the property that the results of applying a change to any bit or bits in M results, with high probability, in a change to the hash code.
  • 4. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 4 Applications of Cryptographic Hash Functions 1. Message authentication 2. Digital Signature 3. One-way password file
  • 5. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 5 1. Message Authentication  Message authentication is a mechanism or service used to verify the integrity of a message.  Message authentication assures that data received are exactly as sent (i.e., contain no modification, insertion, deletion, or replay).  When a hash function is used to provide message authentication, the hash function value is often referred to as a message digest.
  • 6. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 6 Message authentication method - 1  Only A and B share the secret key, the message must have come from A and has not been altered.  The hash code provides the structure required to achieve authentication.  Because encryption is applied to the entire message plus hash code, confidentiality is also provided. E D ll H H M M K K H(M) Compare E (K, [ M || H(M)]) Source A Destination B
  • 7. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 7 Message authentication method - 2  Only the hash code is encrypted, using symmetric encryption.  This reduces the processing burden for those applications that do not require confidentiality. H M Source A Destination B E K ll M E(K, H(M)) H D K Compare
  • 8. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 8 Message authentication method - 3  It is possible to use a hash function but no encryption for message authentication.  A and B share a common secret value S.  A computes the hash value over the concatenation of M and S and appends the resulting hash value to M.  Because B possesses S, it can recompute the hash value to verify.  An opponent cannot modify an intercepted message. M Source A Destination B H ll M H(M || S) H Compare ll S ll S
  • 9. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 9 Message authentication method - 4  Confidentiality can be added to the approach of method (3) by encrypting the entire message plus the hash code. M Source A Destination B H ll M H(M || S) H Compare ll S ll S E K D K E (K, [ M || H(M || S)])
  • 10. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 10 MAC (Message Authentication Code)  More commonly, message authentication is achieved using a MAC also known as keyed hash function.  MACs are used between two parties that share a secret key to authenticate information exchanged between those parties.  A MAC function takes as input a secret key and a data block and produces a hash value, referred to as the MAC.  The combination of hashing and encryption results in an overall function that is, in fact, a MAC (Method -2 in previous slide).
  • 11. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 11 Digital Signature  A digital signature is a mathematical technique used to validate the authenticity and integrity of a message, software or digital document.  The operation of the digital signature is similar to that of the MAC.  In the case of the digital signature, the hash value of a message is encrypted with a user’s private key.  Anyone who knows the user’s public key can verify the integrity of the message that is associated with the digital signature.
  • 12. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 12 Digital Signature method - 1  The hash code is encrypted, using public-key encryption with the sender’s private key.  This provides authentication.  It also provides a digital signature, because only the sender could have produced the encrypted hash code. H M Source A Destination B E PRa ll M E(PRa, H(M)) H D PUa Compare
  • 13. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 13 Digital Signature method - 2  If confidentiality as well as a digital signature is desired, then the message plus the private-key-encrypted hash code can be encrypted using a symmetric secret key. M Source A Destination B E ll M E(Pra, H(M)) H Compare E K D K E (K, [ M || E(Pra, H(M)]) H PRa D PUa
  • 14. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 14 Security Requirements 1. Disclosure 2. Traffic analysis 3. Masquerade 4. Content modification 5. Sequence modification 6. Timing modification 7. Source repudiation 8. Destination repudiation
  • 15. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 15 Requirements for hash functions 1. Can be applied to any sized message M. 2. Produces fixed-length output h. 3. It is easy to compute h=H(M) for any message M. 4. Given hash value h is infeasible to find y such that (H(y) = h) • One-way property 5. For given block x, it is computational infeasible to find y ≠ x with H(y) = H(x) • Weak collision resistance 6. It is computationally infeasible to find messages m1 and m2 with H(m1) = H(m2) • Strong collision resistance
  • 16. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 16 Simple Hash Function  The input (message, file, etc.) is viewed as a sequence of n-bit blocks.  The input is processed one block at a time in an iterative fashion to produce an n-bit hash function.  One of the simplest hash functions is the bit-by-bit exclusive-OR (XOR) of every block. Where, = ith bit of the hash code 1 ≤ i ≤ n m = number of n-bit blocks in the input = ith bit in jth block
  • 17. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 17 SHA - Secure Hash Algorithm SHA - 1 SHA - 224 SHA - 256 SHA - 384 SHA - 512 Message Digest Size 160 224 256 384 512 Message Size < 264 < 264 < 264 < 2128 < 2128 Block Size 512 512 512 1024 1024 Word Size 32 32 32 64 64 Number of Steps 80 64 64 80 80
  • 18. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 18 SHA - 512  The algorithm takes as input a message with a maximum length of less than 2128 bits and produces as output a 512-bit message digest.  The input is processed in 1024-bit blocks.
  • 19. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 20 Message (L bit) 10000…0 L M1 (1024 bits) M2 (1024 bits) MN (1024 bits) F + H1 (512 bits) IV=H0 F + H2 (512 bits) F + HN (512 bits) Message Digest Generation using SHA -512
  • 20. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 21 Step -1 Append Padding Bits  The message is padded so that its length is congruent to 896 modulo 1024 [length ≡ 896(mod 1024)] .  Padding is always added, even if the message is already of the desired length.  Thus, the number of padding bits is in the range of 1 to 1024.  The padding consists of a single 1 bit followed by the necessary number of 0 bits.
  • 21. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 22 Step -2 Append Length  A block of 128 bits is appended to the message.  This block is treated as an unsigned 128-bit integer (most significant byte first) and contains the length of the original message (before the padding).
  • 22. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 23 Step -3 Initialize hash buffer  The outcome of the first two steps produces a message that is an integer multiple of 1024 bits in length.  the expanded message is represented as the sequence of 1024-bit blocks M1 , M2, … , MN, so that the total length of expanded message is N X 1024 bits.  A 512-bit buffer is used to hold intermediate and final results of the hash function. The buffer can be represented as eight 64-bit registers (a, b, c, d, e, f, g, h).
  • 23. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 24 Step -4 Process message in 1024-bit (128-word) blocks  The heart of the algorithm is a module that consists of 80 rounds; this module is labelled F
  • 24. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 26 SHA-512 Processing of a Single 1024-Bit Block Message schedule Mi Hi-1 a b c d e f g e 64 Round 0 K0 a b c d e f g e 64 Round 79 K79 W0 W79 + + + + + + + + Hi
  • 25. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 27 SHA-512 Processing of a Single 1024-Bit Block  Each round takes as input the 512-bit buffer value, abcdefgh, and updates the contents of the buffer.  At input to the first round, the buffer has the value of the intermediate hash value, Hi-1.  Each round t makes use of a 64-bit value Wt, derived from the current 1024-bit block being processed.  The output of the eightieth round is added to the input to the first round (Hi-1) to produce Hi.
  • 26. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 28 Step – 5 Output  After all N 1024-bit blocks have been processed, the output from the Nth stage is the 512-bit message digest
  • 28. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 30 SHA-512 Round Function – Cont… a b c d e f g h b c d e f g h a Ʃ + + Maj + Ʃ Ch + + + Wt + Kt
  • 29. 𝑇 1=h+Ch(𝑒 , 𝑓 , 𝑔)+ (∑ 1 512 𝑒 )+𝑊𝑡 + 𝐾𝑡 𝑇 2=(∑ 0 512 𝑎)+Maj (𝑎 , 𝑏 ,𝑐 )
  • 30. Unit-5 Cryptographic Hash Functions Darshan Institute of Engineering & Technology 32 SHA-512 Round Function Elements  Maj(a,b,c) = (a AND b) XOR (a AND c) XOR (b AND c) Majority of arguments are true  ∑(a) = ROTR(a,28) XOR ROTR(a,34) XOR ROTR(a,39)  ∑(e) = ROTR(e,14) XOR ROTR(e,18) XOR ROTR(e,41)  + = addition modulo 264  Kt = a 64-bit additive constant  Wt = a 64-bit word derived from the current 512-bit input block.

Editor's Notes

  • #2: X.800 and RFC 2828 International Telecommunication Union (ITU)