Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

Difference between SHA1 and SHA256

  • Last Updated : 28 Dec, 2020

1. SHA1 (Secure Hash Algorithm 1) :
SHA1 refers to a cryptographic hash function that is proposed by United States National Security Agency. It takes an input and produces a output of 160 bits hash value. Furthermore the output produced by this function is converted into a 40 digits long hexadecimal number. It is known as U.S. Federal Information Processing Standard. It was first published in 1995. It is successor to SH0 published in 1993.

Example :

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.


Data : Geeksforgeeks
SHA1 : bc7623b7a94ed3d8feaffaf7580df3eca4f5f5ca

2. SHA256 :
SHA-256 is a more secure and newer cryptographic hash function that was launched in 2000 as a new version of SHA functions and was adopted as FIPS standard in 2002. It is allowed to use a hash generator tool to produce a SHA256 hash for any string or input value. Also, it generates 256 hash values, and the internal state size is 256 bit and the original message size is up to 264-1 bits.

Example :

Data : Geeksforgeeks
SHA256 : e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

Difference between SHA1 and SHA256 :

1.SHA1 is a first version of SHA that generates a 160-bit hash value.SHA256 is type of SHA2 that generates a 256-bit hash value.
2.The internal state size of SHA1 is 160.The internal state size of SHA256 is 256.
3.It is less secure as compared.It is more secure than SHA1.
4.The output size of SHA1 is 160 bits.The output size of SHA256 is 256 bits.
5.It is used by SSL certificate authorities to sign certificates.It is hash function commonly used in blockchain.
6.It has smaller bit size, so it become more susceptible to attacks.It has 256 bits so it has improved security.

My Personal Notes arrow_drop_up
Recommended Articles
Page :