Professional Documents
Culture Documents
HASH
ALGORITHM
Secure Hash Algorithm ( SHA )
It works for any input message that is less than 264 bits.
1 0 1 1 0 1 0 0 0 0 0 0 0 0 …………………………… 0 0 0 0 1 1 0
Original Length of
Padding of 0’s to 64 bits short of X 512
string message
Where,
abcde = The register made up of 5 variables a, b, c, d, e.
Process P = The logic operation.
St = Circular-left shift of 32-bit sub-block by t bits.
W[t[ = A 32-bit derived from the current 32-bit sub-block.
K[t] = One of the five additive constants.
How SHA-1 works cont…
Process P in each SHA round
Round Process P
2 b XOR c XOR d
4 b XOR c XOR d
How SHA-1 works cont…
A= 6A09E667F3BCC908 B= BB67AE8584CAA73B
C= 3C6EF372FE94F82B D= A54FF53A5F1D36F1
E= 510E527FADE6821D F= 9B05688C2B3E6C1F
G= 1F83D9ABFB41BD6B H= 5BE0CD19137E2179
How SHA-512 works cont…
Step 5 : Process blocks.
Step 5.1 : Copy the variables A-H to a-h.
Step 5.2 : Divide the 1024-bit block into 16 sub-blocks of
64-bit each.
Step 5.3 : It takes 80 rounds with 1024-bit block, abcdefgh
register and K[t] constant as three inputs.
Each round consists of following operations:
Temp1 = h + Ch(e,f,g) + Sum (e[i] for i=1 to 512) + W[t] + K[t]
Temp2 = Sum (a[i] for i=0 to 512) + Maj(a,b,c)
a = Temp1 + Temp2
b=a
c=b
How SHA-512 works cont…
d=c
e = d + Temp1
f=e
g=f
h=g
Where,
t = round number
Ch (e,f,g) = (e AND f) XOR (NOT e AND g)
Maj (a,b,c) = (a AND b) XOR (a AND c) XOR (b AND c)
Sum (a[i]) = ROTR (a[i] by 28 bits) XOR ROTR (a[i] by 34 bits)
XOR ROTR (a[i] by 39 bits)
Sum (e[i]) = ROTR (e[i] by 14 bits) XOR ROTR (e[i] by
18 bits) XOR ROTR (e[i] by 41 bits)
How SHA-512 works cont…
ROTR(x) = Circular right shift, i.e. rotation , of the 64-bit
array x by the specified no. of bits.
W[t] = 64-bit word derived from the current 512-bit input
block.
K[t] = 64-bit additive constant.
+ (or Add) = Addition mod 264.
In case of values of W[t] , for the first 16 rounds (0 to 15) ,
the value of W[t] is equal to the corresponding word in the
message block.
For the remaining 64 steps, the value W[t] is equal to the
circular left shift by one bit of the XOR of the four preceding
values of W[t] with two of them subjected to shift and rotate
operations
How SHA-512 works cont…