Secure Hash Function
Secure Hash Function
Secure Hash Function
The simplest hash function is the list-by-list XOR of every block, expressed as
following:
Where
=XOR operation.
:
:
Block m b1m bnm
C1 C2 Cn
Hash
code
Note1: Fig.7 produces a simple parity for each bit position, and is known as
a longitudinal redundancy check. It is reasonably effective for random data as a
data integrity check.
Oct. 9, 2003 1
S. Erfani, ECE Dept., University of Windsor 0688-590-18 Network Security
Another scheme, originally proposed by NIST, used the simple XOR applied to
64 bit blocks of the message and then an encryption of the entire message that
used the cipher block-chaining (CBC) mode. In other words, given a message
consisting of a sequence of 64 bit blocks X 1, X2, …., XN, define the hash code C
as the block and append the hash code as the final block:
C = XN+1 = X1 X2 …. XN
Next, encrypt the entire message plus hash code, using CBC mode to produce
the encrypted message Y1, Y2, …., YN+1.
Note 2: It was shown that the above scheme to produce a hash code is not
secure.
The secure hash algorithm ( SHA ) was developed by NIST in 1993 (FIPS
PUB180). A revised version referred to as SHA-1 was issued in 1995 ( FIPS PUB
180-1). The algorithm takes as input a message with a maximum length of less
than 2 64 bits
Oct. 9, 2003 2
S. Erfani, ECE Dept., University of Windsor 0688-590-18 Network Security
And produces as output a 160-bit message digest. The input is processed in 512
– bit blocks. Figure 8 shows the overall processing of a message to produce a
digest. The processing consists of the following steps:
The (plaintext message is padded so that its length is congruent to 448 module
512. 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 512. The padding
consists of a single 1-bit followed by the necessary number of 0-bits.
The outcome of these two steps yields a message that is an integer multiple of
512 bits in length. In Figure 8 the expanded message is represented as the
sequence of 512-bit blocks Y0, Y1, ….., Y2-1, so that the total length of the
expanded message is L x 512 bits. Equivalently, the result is a multiple of 16
32-bit words. Let M [0…….N-1] denote the words of the resulting message, with
N an integer multiple of 16. Thus, N=Lx16.
160-bit buffer is used to hold intermediate and final results of the hash function.
The buffer can be represented as five 32-bit registers (A,B,C,D,E). These
registers are initialized to the following 32-bit integers (hexadecimal values):
A = 67452301
B = EFCDAB89
C = 98BADCFF
D = 10325476
E = C3D2E1F0
Each round takes as input the current 512-bit block being processed, Y q and the
160-bit buffer value ABCDE and updates the contents of the buffer. Each round
Oct. 9, 2003 3
S. Erfani, ECE Dept., University of Windsor 0688-590-18 Network Security
also uses an additive constant K t, where 0<= t <= 79 indicates one of the 80
steps across five rounds.
In fact, only four distinct constants are used. The values, in hexadecimal and
decimal, are as follows:
Oct. 9, 2003 4
S. Erfani, ECE Dept., University of Windsor 0688-590-18 Network Security
The output of the fourth round (eightieth step) is added to the input to the first
round, CVq , to produce CVq+1. The addition is done independently for each of the
five words in the buffer with each of the corresponding words in CV q , using
addition module 232.
Step 5 – Output
After all L 512-bit blocks have been processed, the output from the Lth stage is
the 160-bit message digest.
Note 1 The SHA-1 algorithm has the property that every bit of the hash
code is a function of every bit of the input. The complex repetition of the basic
function of ft produces results that are well mixed. It is unlikely that two messages
chosen at random will have the same hash code.
Note 2 The difficulty of coming up with two messages having the same
message digest is on the order of 2 80 operations. The difficulty of finding a
message with a given digest is on the order of 2 160 operations.
Oct. 9, 2003 5