SHA stands for Secure Hash Algorithm. SHA has been published by the National Institute of Standards and Technology (NIST) as a part of the Federal Information Processing Standard (FIPS) FIPS PUB 180-1.
SHA is a cryptographic hash function similar to MD5, and it generates a 160-bit message digest or, in other words, a hash value from a variable-length input.
SHA-1 is the successor of SHA-0. SHA-0 was withdrawn due to severe weaknesses, and SHA-1 was introduced, which corrected that error. SHA-1 works on 512-bit blocks of data at a time and 32-bit words.
The output is a 160-bit hash value created due to 80 rounds of processing. The internal operations carried out in the SHA-1 algorithm are +, and, or, xor, not.
Until 2005 SHA-1 was considered relatively secure, but that changed in 2005 when a mathematical weakness was found in SHA-1. This led the NIST to work on a better and stronger hashing algorithm, and hence SHA-2 came into existence.
SHA-1 has been implemented in most security applications and under the security protocols, namely the TLS, SSL, PGP, IPSec & S/MIME. The main impetus behind the success of SHA-1 was the Digital Signature Standard (DSS) which is one of the most used standards around the world for digital certificates and digital signatures.
The SHA algorithm is based on the SHACAL block ciphers.
Often MD5 and SHA-1 are used in conjunction with each other and often used as substitutes. The MD5 hashing algorithm or the SHA-1 algorithm is used while performing the cryptographic functions.
SHA-1 has been announced as being weak due to the presence of a collision attack. Hence, the US government has started advising that SHA-2 should be used rather than SHA-1 in the applications that the government utilizes.