Saturday, July 17, 2021

Secure Hash Algorithm – 1 | Working of SHA 1 | Compare diffrernt version of SHA | Difference between SHA 1 and MD 5


Secure Hash Algorithm – 1 (SHA – 1)



The secure hash algorithm (SHA) was developed by National Institute of Standards and Technology (NIST). It is based on MD4 algorithm. Based on different digest lengths, SHA includes algorithms such as SHA-1, SHA-256, SHA-384 and SHA-512. Unlike encryption, given a variable length message x, a secure hash algorithm computes a function H(x) which has a fixed bit. When a message of any length is less than 264 bits is input, the SHA-1 produces a 160-bit output called message digest. SHA-1 called secure because it is computationally infeasible to find a message which corresponds to a given message digest, or to find two different messages which produce the same message digest. The most commonly used hash function from the SHA family is SHA-1. SHA-1 is used in SSL/TLS, PGP, SSH, MIME and IPsec for security and authentication purpose.


Features of SHA – 1

Message or data file used as input in SHA-1 to compute a message digest (output of hash function or final hash value). The message or data file should be considered to be a bit string. The length of the message is the number of bits in the message (the empty message has length 0). The purpose of message padding is to make the total length of a padded message a multiple of 512. (If any message length is 1000 bits, so padded 24 bits to make message into multiple of 512 bits). The SHA-1 sequentially processes blocks of 512 bits when computing the message digest.


Working of SHA – 1

Figure : SHA - 1 working process

SHA1 works with any input message that is less than 264 bits in length. The output of SHA is a message digest, which is 160 bits in length.

Step – 1: Padding - The first step of SHA-1 is added padding to the end of original message to prepare message in multiple of 512 bits.

Step – 2: Append Length – The length of message excluding the length of the padding is now calculated and appended to the end of the padding as 64-bit block. (message length is 64 bits short of multiple of 512).

Step – 3: Divide the input into 512-bit blocks: The input message is now divided into blocks, each of length 512 bits.

Step – 4: Initialize chaining variables: Now, five chaining variables A to E are initialized. Each of 32 bits variable produces 160 bits length of message digest.

Step – 5: Process Block & Output – Combination of A-E chaining variable is called ABCDE, will be considered as a single register. Now divided the current 512-bit block into 16 sub blocks, each consisting of 32 bits. (32x16=512) SHA-1 has perform four rounds. Each round takes the current 512-bit block, the register ABCDE and constant K(t) (where t=0 to 79) as input. SHA consists of four rounds, each round containing 20 iteration. So total iteration is 80. The logical operation of a single SHA-1 iteration looks as shown in figure. Mathematically, an iteration consists of the following operation:

 ABCDE = E + Process P + S 5(a) + W(t) + K(t)


Comparison of different SHA version

SHA – 1 was cracked in the year 2005. New hash function SHA-512 is introduced to overcome problem SHA-1.

Difference between SHA 1 and MD 5

To learn more about Secure Hash Algorithm (SHA - 1), watch below video

Video : Secure Hash Algorithm (SHA - 1)

Video : Difference between SHA 1 and MD 5

Watch more videos click here.

No comments:

Post a Comment