1. SHA1 (Secure Hash Algorithm 1) :
SHA1 is a cryptographic hash function which is designed by United States National Security Agency. It takes an input and produces a 160 bits hash value. Further the output produced by this function is converted into a 40 digits long hexadecimal number. It is a U.S. Federal Information Processing Standard. It was first published in 1995. It is successor to SH0 published in 1993.
Data : Geeksforgeeks SHA1 : bc7623b7a94ed3d8feaffaf7580df3eca4f5f5ca
2. SHA2 (Secure Hash Algorithm 2) :
SHA1 is also a cryptographic hash function which is designed by United States National Security Agency. It is constructed using the Merkle-Damgard structure from a one-way compression function. The compression function used is constructed using the Davies-Meyer structure from a classified block cipher. It was first published in 2001. It is successor to SH1.
Data : Geeksforgeeks SHA2(256) : 86d755349c6b9f95f365c6ffe7734f25bf2b00cabe8c6bc5f2b8b746c1aac332
Difference between SHA1 and SHA2 :
|It is a cryptographic hash function designed by U.S National Security Agency to replace SH0.||It is a cryptographic hash function designed by U.S National Security Agency to replace SH1.|
|It was published in 1995.||While it was published in 2001.|
|It produces 160 bits hash value.||It produces 224, 256, 384 or 512 bits hash value.|
|It is successor to SH0 and predecessor to SH2.||It is successor to SH1 and predecessor to SH3.|
|It is less secure.||While it is more secure.|
|Its structure is based on Merkle–Damgard construction.||Its structure is based on Merkle–Damgard structure with Davies–Meyer compression function.|
|SHA1 certificates are not reliable.||SHA2 has more improved certificates.|
|It generates smaller hash.||While it generates larger hash.|
|Hash generated by SHA1 is weak.||While hash generated by SHA2 is strong.|
|It is not widely used now-a-days.||While it is used widely.|
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Difference between MD5 and SHA1
- Difference between 4NF and 5NF
- Difference between RAM and ROM
- Difference between MP4 and MP3
- Difference between BFS and DFS
- Difference between DFA and NFA
- Difference between IoT and M2M
- Difference Between SMO and SEO
- Difference between ADO and ADO.NET
- Difference between GSM and LTE
- Difference between DML and TCL
- Difference Between SEO and SEM
- Difference between PCI and PCI-X
- Difference between PCI-E and PCI-X
- Difference between PIP and HLP
- Difference between PIP and PCP
- Difference between HLP and PCP
- Difference between DTE and DCE
- Difference Between Gi-Fi and Li-Fi
- What is the difference between GUI and CUI?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.