Background: the SHA-2 hash family
SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the United States National Security Agency (NSA) and first published in 2001. They are built using the Merkle–Damgård construction, from a one-way compression function itself built using the Davies–Meyer structure from a specialized block cipher.
SHA-2 includes significant changes from its predecessor, SHA-1. The SHA-2 family consists of six hash functions with digests (hash values) that are 224, 256, 384 or 512 bits: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, SHA-512/256. SHA-256 and SHA-512 are hash functions whose digests are eight 32-bit and 64-bit words, respectively. They use different shift amounts and additive constants, but their structures are otherwise virtually identical, differing only in the number of rounds.
SHA-224 and SHA-384 are truncated versions of SHA-256 and SHA-512 respectively, computed with different initial values. SHA-512/224 and SHA-512/256 are also truncated versions of SHA-512, but the initial values are generated using the method described in Federal Information Processing Standards (FIPS) PUB 180-4.
SHA-2 was first published by the National Institute of Standards and Technology (NIST) as a U.S. federal standard. The SHA-2 family of algorithms are patented in the U.S. The United States has released the patent under a royalty-free license.
5 sources for this section
- 1SHA-2 — Wikipedia, revision 1368593841
- 2Penard, Wouter; van Werkhoven, Tim. "On the Secure Hash Algorithm family" (PDF). staff.science.uu.nl. Archived from the original (PDF) on 2016-03-30.
- 3Announcing Approval of FIPS Publication 180-2
- 4"IPR Details: The United States of America as represented by the National Security Agency's general license statement". IETF Datatracker. 858. Archived from the original on 2016-06-16. Retrieved 2008-02-17.
- 5US 6829355
Hash standard
With the publication of FIPS PUB 180-2, NIST added three additional hash functions in the SHA family. The algorithms are collectively known as SHA-2, named after their digest lengths (in bits): SHA-256, SHA-384, and SHA-512.
The algorithms were first published in 2001 in the draft FIPS PUB 180-2, at which time public review and comments were accepted. In August 2002, FIPS PUB 180-2 became the new Secure Hash Standard, replacing FIPS PUB 180-1, which was released in April 1995. The updated standard included the original SHA-1 algorithm, with updated technical notation consistent with that describing the inner workings of the SHA-2 family.
In February 2004, a change notice was published for FIPS PUB 180-2, specifying an additional variant, SHA-224, defined to match the key length of two-key Triple DES. In October 2008, the standard was updated in FIPS PUB 180-3, including SHA-224 from the change notice, but otherwise making no fundamental changes to the standard. The primary motivation for updating the standard was relocating security information about the hash algorithms and recommendations for their use to Special Publications 800-107 and 800-57.
Detailed test data and example message digests were also removed from the standard, and provided as separate documents.
7 sources for this section
- 1SHA-2 — Wikipedia, revision 1368593841
- 3Announcing Approval of FIPS Publication 180-2
- 6"FIPS 180-2 with Change Notice 1" (PDF). csrc.nist.gov. Archived (PDF) from the original on 2017-08-09. Retrieved 2022-02-15.
- 7Announcing Approval of FIPS Publication 180-3
- 8Dang, Quynh (2012-08-24). Recommendation for Applications Using Approved Hash Algorithms (Report). National Institute of Standards and Technology. Archived from the original on 2023-08-28. Retrieved 2023-08-28.
Applications
The SHA-2 hash function is implemented in some widely used security applications and protocols, including TLS and SSL, PGP, SSH, S/MIME, and IPsec. The inherent computational demand of SHA-2 algorithms has driven the proposal of more efficient solutions, such as those based on application-specific integrated circuits (ASICs) hardware accelerators.
SHA-256 is used for authenticating Debian software packages and in the DKIM message signing standard; SHA-512 is part of a system to authenticate archival video from the International Criminal Tribunal of the Rwandan genocide. SHA-256 and SHA-512 are used in DNSSEC. Linux distributions usually use 512-bit SHA-2 for secure password hashing.
Several cryptocurrencies, including Bitcoin, use SHA-256 for verifying transactions and calculating proof of work or proof of stake. The rise of ASIC SHA-2 accelerator chips has led to the use of scrypt-based proof-of-work schemes.
9 sources for this section
- 1SHA-2 — Wikipedia, revision 1368593841
- 11Franck, Lucas Daudt; Ginja, Gabriel Augusto; Carmo, João Paulo; Afonso, Jose A.; Luppe, Maximiliam (2024). "Custom ASIC Design for SHA-256 Using Open-Source Tools". Computers. 13 (1): 9. doi:10.3390/computers13010009. hdl:1822/89307.
- 12"Verifying authenticity of Debian images". Archived from the original on 2024-02-19. Retrieved 2024-02-19.
- 13Markoff, John (2009-01-27). "A Tool to Verify Digital Records, Even as Technology Shifts". The New York Times. ISSN 0362-4331. Archived from the original on 2023-09-19. Retrieved 2023-08-27.
- 14Hardaker, Wes (2022-08-12). Remove SHA-1 from active use within DNSSEC (Report). Internet Engineering Task Force.
- 15"Security/Features - Debian Wiki". wiki.debian.org. Retrieved 2025-01-13.
Cryptanalysis and validation
For a hash function for which L is the number of bits in the message digest, finding a message that corresponds to a given message digest can always be done using a brute force search in 2^(L) evaluations. This is called a preimage attack and may or may not be practical depending on L and the particular computing environment. The second criterion, finding two different messages that produce the same message digest, known as a collision, requires on average only 2^(L/2) evaluations using a birthday attack.
Some of the applications that use cryptographic hashes, such as password storage, are only minimally affected by a collision attack. Constructing a password that works for a given account requires a preimage attack, as well as access to the hash of the original password (typically in the shadow file) which may or may not be trivial. Reversing password encryption (e.g., to obtain a password to try against a user's account elsewhere) is not made possible by the attacks. (However, even a secure password hash cannot prevent brute-force attacks on weak passwords.)
In the case of document signing, an attacker could not simply fake a signature from an existing document—the attacker would have to produce a pair of documents, one innocuous and one damaging, and get the private key holder to sign the innocuous document. There are practical circumstances in which this is possible; until the end of 2008, it was possible to create forged SSL certificates using an MD5 collision which would be accepted by widely used web browsers.
2 sources for this section
Official validation
Implementations of all FIPS-approved security functions can be officially validated through the CMVP program, jointly run by the National Institute of Standards and Technology (NIST) and the Communications Security Establishment (CSE). For informal verification, a package to generate a high number of test vectors is made available for download on the NIST site; the resulting verification, however, does not replace the formal CMVP validation, which is required by law for certain applications.
As of December 2013,^([update]) there are over 1300 validated implementations of SHA-256 and over 900 of SHA-512, with only 5 of them being capable of handling messages with a length in bits not a multiple of eight while supporting both variants.
The source notesEvidence & further reading21 sources
- SHA-2 — Wikipedia, revision 1368593841 Wikipedia contributors · Reference source · accessed 2026-09-22
- Penard, Wouter; van Werkhoven, Tim. "On the Secure Hash Algorithm family" (PDF). staff.science.uu.nl. Archived from the original (PDF) on 2016-03-30. staff.science.uu.nl · Reference source · link imported 2026-09-22
- Announcing Approval of FIPS Publication 180-2 federalregister.gov · Reference source · link imported 2026-09-22
- "IPR Details: The United States of America as represented by the National Security Agency's general license statement". IETF Datatracker. 858. Archived from the original on 2016-06-16. Retrieved 2008-02-17. datatracker.ietf.org · Reference source · link imported 2026-09-22
- US 6829355 worldwide.espacenet.com · Reference source · link imported 2026-09-22
- "FIPS 180-2 with Change Notice 1" (PDF). csrc.nist.gov. Archived (PDF) from the original on 2017-08-09. Retrieved 2022-02-15. csrc.nist.gov · Reference source · link imported 2026-09-22
- Announcing Approval of FIPS Publication 180-3 federalregister.gov · Reference source · link imported 2026-09-22
- Dang, Quynh (2012-08-24). Recommendation for Applications Using Approved Hash Algorithms (Report). National Institute of Standards and Technology. Archived from the original on 2023-08-28. Retrieved 2023-08-28.