SHA-1 or Secure Hash Algorithm 1 is a cryptographic hash function which takes an input and produces a 160-bit (20-byte) hash value. It was designed by the National Security Agency (NSA). It is currently a Federal Information Processing Standard. SHA-1 is now considered insecure since 2005. SHA-1 shouldn’t be used for digital signatures or certificates anymore. Theoretically broken since 2005, it was formally deprecated by the National Institute of Standards and Technology (NIST) in 2011. In 2017, SHA-1 was officially broken by Google’s academics, who managed to produce two files with the same hash.
SHA1 is relatable to MD5 as it is based on MD5. Like MD5, SHA-l processes input data in 512-bit blocks.
SHA-l generates a 160-bit message digest. Whereas MD5 generated message digest
of 128 bits.
Working of SHA-1:
As we know that SHA1 is modelled after MD5 and most
of its steps resemble MD5. So, here we will explain the SHA1 steps briefly.
Step 1: Append Padding Bits
This step adds the padding to the end of the
genuine message in such a manner that the length of the message is 64 bits less
of the multiple of 512. Padding is
continually inserted although the message already has the desired length.
Padding includes a single 1 followed by the essential number of 0 bits.
Step 2: Append Length
64 bits are appended to the end of the
padded message. These bits hold the binary format of 64 bits indicating the
length of the original message. The complete
message's length is a multiple of 512.
Step 3: Initialize the Buffer
The
buffer includes five (5) registers of 32 bits each indicated by A, B, C, D, and
E. This 160-bit buffer can be used to influence temporary and final outcomes of
the compression function. These five registers are initialized to the following
32-bit integers (in hexadecimal notation).
A = 67 45 23 01
B = ef cd ab 89
C = 98 ba dc fe
D = 10 32 54 76
E = c3 d2 e1 f0
The registers A, B, C, and D are actually the same as the four registers used in MD5 algorithm.
Step 4: Process message in 512-bit blocks
The
compression function is divided into 20 sequential steps includes four rounds
of processing where each round is made up of 20 steps.
The four rounds are structurally same
as one another with the only difference that each round need a different
Boolean function, which it can define as f1, f2, f3, f4 and one of four
multiple additive constants K[i] (0 ≤i ≤79) which is based on the step under
consideration.
After processing the
final 512-bit message block t (considering that the message is divided into t
512-bit blocks), and it can obtain a 160-bit message digest.
However, in SHA1 there are four
rounds and each round consist of 20 steps where each round takes the current
512-bit block, the register abcde and constant K[i] (where i=0 to 79) as the
three inputs.
Difference between MD5 and SHA1
The MD5 and SHA1 are the hashing algorithms where MD5 is better than SHA in terms of speed. However, SHA1 is more secure as compared to MD5. The concept behind these hashing algorithms is that these are used to generate a unique digital fingerprint of data or message which is known as a hash or digest.
BASIS FOR COMPARISON |
MD5 |
SHA1 |
Stands for |
Message Digest5 |
Secure Hash Algorithm |
Length of Message Digest |
128 bits |
160 bits |
Discerning of original message
would require |
2128 operations |
2160 operations |
For finding two messages
generating the same message digest |
264 operations would be needed |
280 operations are required |
Security |
Poor |
Moderate |
Speed |
Fast |
Slow |
0 Comments
if you have any doubts plz let me know...