CH 12 Hash Function
CH 12 Hash Function
[Part 3]
Integrity, Authenticity, and Key
Management
Chapter 12
Forouzan, B.A. Cryptography and Network Security (International Edition). United States: McGraw Hill, 2008. 1.1
Chapter 12 Objectives
1.2
m @ 2015/2016-1 1
SCSR3443 Cryptography 26-Nov-15
Chapter 12 Contents
12.1 Introduction
12.2 SHA-512
12.3 Summary
1.3
Chapter 11 Contents
12.1 Introduction
12.2 SHA-512
12.3 Summary
1.4
m @ 2015/2016-1 2
SCSR3443 Cryptography 26-Nov-15
1.5
1.6
m @ 2015/2016-1 3
SCSR3443 Cryptography 26-Nov-15
Merkle-Damgard Scheme
• This is an iterated hash function that is collision resistant
if the compression function is collision resistant.
• This is the basis for many cryptographic hash functions today.
1.7
m @ 2015/2016-1 4
SCSR3443 Cryptography 26-Nov-15
Groups of Compression
Functions
1.10
m @ 2015/2016-1 5
SCSR3443 Cryptography 26-Nov-15
1.11
1.12
m @ 2015/2016-1 6
SCSR3443 Cryptography 26-Nov-15
1.13
1.14
m @ 2015/2016-1 7
SCSR3443 Cryptography 26-Nov-15
1.15
Chapter 12 Contents
12.1 Introduction
12.2 SHA-512
12.3 Summary
1.16
m @ 2015/2016-1 8
SCSR3443 Cryptography 26-Nov-15
1.17
1.18
m @ 2015/2016-1 9
SCSR3443 Cryptography 26-Nov-15
Message Preparation
1.19
Example 12.1: This example shows that the message length limitation
of SHA-512 is not a serious problem. Suppose we need
to send a message that is 2128 bits in length.
Solution 12.1: A communications network that can send 264 bits per
second is not yet available.
m @ 2015/2016-1 10
SCSR3443 Cryptography 26-Nov-15
Solution 12.2: Suppose that a character is 32, or 26, bits. Each page is
less than 2048, or approximately 212, characters.
m @ 2015/2016-1 11
SCSR3443 Cryptography 26-Nov-15
1.23
Example 12.3: What is the number of padding bits if the length of the
original message is 2590 bits?
1.24
m @ 2015/2016-1 12
SCSR3443 Cryptography 26-Nov-15
Solution 12.4: Yes we do, because we need to add the length field.
1.25
This means that |M| = −128 mod 1024 = 896 mod 1024 bits.
1.26
m @ 2015/2016-1 13
SCSR3443 Cryptography 26-Nov-15
Words
• SHA-512 operates on words of 64 bits.
• This means that after the padding and the length field are
added to the message, each block of the message consists
of sixteen 64-bits words.
• The message digest also made of 64-bit words, but it is only
eight words that named as A, B, C, D, E, F, G, and H.
m @ 2015/2016-1 14
SCSR3443 Cryptography 26-Nov-15
Words Expansion
1.29
m @ 2015/2016-1 15
SCSR3443 Cryptography 26-Nov-15
Solution 12.6: Each word in the range W16 to W79 is made from four
previously-made words.
1.31
1.32
m @ 2015/2016-1 16
SCSR3443 Cryptography 26-Nov-15
1.33
Figure 12.9:
Compression function
in SHA-512
1.34
m @ 2015/2016-1 17
SCSR3443 Cryptography 26-Nov-15
Figure 12.10:
Structure of each
round in SHA-512
1.35
Majority Function:
Conditional Function:
Rotate Functions:
1.36
m @ 2015/2016-1 18
SCSR3443 Cryptography 26-Nov-15
Constants
• Similar to the initial values for the eight digest buffer, these
values are calculated from the first 80 prime numbers (2, 3,
…, 409).
• For example: The 80th prime is 409, with the cubic root
(409)1/3 = 7.42291412044. Converting this number to binary
with only 64 bits in the fraction part, we get:
1.38
m @ 2015/2016-1 19
SCSR3443 Cryptography 26-Nov-15
Solution 12.7: The digits in binary are 0111, 1010, and 1110.
Solution 12.8: The digits in binary are 1001, 1010, and 1111.
m @ 2015/2016-1 20
SCSR3443 Cryptography 26-Nov-15
1.41
Chapter 12 Contents
12.1 Introduction
12.2 SHA-512
12.3 Summary
1.42
m @ 2015/2016-1 21
SCSR3443 Cryptography 26-Nov-15
1.44
m @ 2015/2016-1 22
SCSR3443 Cryptography 26-Nov-15
Chapter 12 Exercises
Forouzan,B.A. Cryptography and Network Security (International Edition). Singapore: McGraw-Hill, 2008. (page 386) 1.45
Chapter 12 Exercises
Exercise 12.2: What is the padding for SHA-512 if the length of the
message is:
a) 5120 bits.
b) 5121 bits.
c) 6143 bits.
Forouzan,B.A. Cryptography and Network Security (International Edition). Singapore: McGraw-Hill, 2008. (page 386) 1.46
m @ 2015/2016-1 23