The Secure Hash Function (SHA) : Network Security
The Secure Hash Function (SHA) : Network Security
HASH
FUNCTION
(SHA)
Network Security
1
Objectives of the Topic
After completing this topic, a student will be able to
explain working of the secure hash algorithm (SHA).
2
Figures and material in this topic have been adapted
from
“Network Security Essentials : Applications and
Standards”, 2014, by William Stallings.
4
THE SECURE HASH
FUNCTION (SHA)
5
When weaknesses were discovered in SHA (now known
as SHA-0), a revised version was issued as FIPS 180-1 in
1995 and is referred to as SHA-1.
6
THE SECURE HASH
FUNCTION (SHA)
In 2002, NIST produced FIPS 180-2.
Three new versions of SHA with hash value lengths of
256, 384, and 512 bits known as SHA-256, SHA-384,
and SHA-512 were defined.
Collectively, these are known as SHA-2.
7
THE SECURE HASH Comparison of SHA
8
THE SECURE HASH
FUNCTION (SHA)
In 2005 NIST announced the intention to phase out
approval of SHA-1 and move to a reliance on SHA-2 by
2010.
We focus on SHA-512.
9
SHA-512 Logic:
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.
10
THE SECURE HASH
FUNCTION (SHA)
Step 1: Append padding bits
Padding is added, even if the message is already of the
desired length. No. of Padding bits = [1 1024]
Padding consists of a single 1 bit followed by the
necessary number of 0 bits.
11
Step 2: Append length
A block of 128 bits is appended to the message.
This block is treated as an unsigned 128-bit integer and
contains the length of the original message (before the
padding).
12
THE SECURE HASH
FUNCTION (SHA)
Outcome of first two steps yields a message an integer
multiple of 1024 bits in length.
Total length of the expanded message is N × 1024 bits as
the expanded message is a sequence of 1024-bit blocks
M1, M2, . . ., MN.
13
THE SECURE HASH Message Digest
Generation of SHA-
FUNCTION (SHA) 512
14
THE SECURE HASH
FUNCTION (SHA)
15
THE SECURE HASH
FUNCTION (SHA)
Step 3: Initialize hash buffer
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).
16
THE SECURE HASH
FUNCTION (SHA)
Initialize these registers by taking the first sixty-four bits
of the fractional parts of the square roots of the first
eight prime numbers.
17
THE SECURE HASH Initialization of the
18
THE SECURE HASH
FUNCTION (SHA)
Step 4: Process message in 1024-bit (128-word) blocks
The module labeled F consists of 80 rounds.
Each round takes as input the 512-bit buffer value
abcdefgh and updates the contents of the buffer.
19
THE SECURE HASH
FUNCTION (SHA)
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 (Mi).
20
THE SECURE HASH
FUNCTION (SHA)
Each round also makes use of an additive constant Kt,
where t = 0 … … 79.
The constants eliminate any regularities in the input
data.
21
THE SECURE HASH FUNCTION (SHA)
The output of the 80th round is
added to the input to the first
round (Hi-1) to produce Hi .
22
THE SECURE
HASH
FUNCTION
(SHA)
Processing of a Single
1024-Bit Block
23
THE SECURE HASH FUNCTION (SHA)
Step 5 Output:
After all N 1024-bit blocks have
been processed, the output from
the Nth stage is the 512-bit
message digest.
In 2012, NIST formally published
SHA-3.
En
d
24