SHA




SHA-1 or Secure Hash Function 1 is a cryptographic hash function which takes an input and produces a 160-bit(20 byte) hash value, typically rendered as a hexadecimal number, 40 digit long.

This hash value is known as a message digest.

SHA was designed by NIST and NSA in 1993, revised in 1995 as SHA-1.

Created based on MD4 with key difference,

It has following versions:

  • SHA-0
  • SHA-1
  • SHA-2
  • SHA-3






working of SHA:
  1. Padding message, so it's length is 448 mod 512.
  2. Append a 64 bit length value to message.
  3. Initialize 5-word(160 bit) buffer(A, B, C, D, E)  also known as chaining variables.
               A= 67452301
               B= EFCDAB89
               C= 98BADCFE
               D= 10325476
               E= C3D2E1F0

      4. Process message in 16-word(512 bit) chunks of 32 bit:
          
             a. Consist of four rounds of processing of 20 steps each.
             b. Four rounds use different primitive logical function, f1,f2,f3,f4.
             c. Each round takes as i/p the current 512 bit block-being processed (Yq) and 160 bit buffer                     value A,B,C,D,E and updates buffer.
      
     5. Each round use a additive constant Kt where 0<=t<=79, indicates one of the eighty steps 
         across  four rounds.

     6. Output of the fourth round is added with the i/p of the first round(CVq) to produce CVq+1

     7. After the addition of the first and last round a 160 bit final output is created.
  

SHA-1 has a total of 80 iterations (4 rounds* 20 steps). Eaach iteration has a operation
         
            ABCDE=(E+f(t, B, C, D)+S^5(A)+Kt+Wt),A,S^30(B),C,D)


                         where  A, B, C, D, E refers to the 4 words of the buffer
                         f(t,B,C,D) is a non-linear function for each round
                         Wt is derived from message block
                         Kt is one of the five additive constant



FUNCTION FOR EACH ROUND













Comments