← Wiki Index / Computation & Algorithms / Secure Hash Algorithms
💻 Computation & Algorithms

Secure Hash Algorithms

The Secure Hash Algorithms are a family of cryptographic hash function standards published by the National Institute of Standards and Technology encompassing SHA-1, the Merkle–Damgård SHA-2 family, and the permutation-based SHA-3 sponge standard.

Secure Hash Algorithms (SHA) is an internationally standardized family of cryptographic hash functions in computation and algorithms published by the United States National Institute of Standards and Technology (NIST) as Federal Information Processing Standards (FIPS). Spanning four major architectural generations—SHA-0, SHA-1, SHA-2, and SHA-3—the SHA family provides deterministic data integrity, digital signature digest formatting, and pseudo-random key derivation across global telecommunications, operating systems, and cryptographic protocols.

The historical trajectory of the Secure Hash Algorithms reflects the empirical evolution of modern cryptanalysis: transitioning from early 160-bit iterative constructions susceptible to algebraic differential attacks toward widened 256-bit and 512-bit Merkle–Damgård pipelines, and ultimately adopting the Keccak permutation-based sponge construction.

Evolution of the Standard Generations

The development of the SHA family progressed through four distinct historical phases:

  1. SHA-0 (1993): Originally published as FIPS PUB 180, this 160-bit hash function was withdrawn by NIST shortly after release due to an undisclosed flaw identified by the National Security Agency (NSA).
  2. SHA-1 (1995): Published as FIPS PUB 180-1, SHA-1 corrected the flaw in SHA-0 by introducing a single circular bit rotation in its message expansion schedule. Despite this correction, theoretical collision attacks formulated by Xiaoyun Wang in 2005 reduced collision complexity from 280 to 269 operations. In 2017, researchers from CWI Amsterdam and Google announced the SHAttered attack, producing two distinct PDF documents with identical SHA-1 hashes in 263 computations, precipitating the global decommissioning of SHA-1 in internet security standards.
  3. SHA-2 (2001): Published as FIPS PUB 180-2, the SHA-2 family introduced substantial structural redesigns and expanded word sizes, comprising four core variants: SHA-224, SHA-256, SHA-384, and SHA-512 (with truncated variants SHA-512/224 and SHA-512/256 added later). SHA-2 remains the primary cryptographic workhorse of modern global telecommunications.
  4. SHA-3 (2015): Following an open international competition modeled after the AES evaluation, NIST selected the Keccak algorithm designed by Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche as FIPS PUB 202. SHA-3 provides structural diversity by departing from the Merkle–Damgård framework in favor of the sponge construction.

Mathematical Architecture of the SHA-2 Family

The SHA-2 family is built upon an iterative Merkle–Damgård framework paired with a Davies–Meyer compression function. The algorithm partitions input data into 512-bit blocks (for SHA-224 and SHA-256, operating on 32-bit words) or 1024-bit blocks (for SHA-384 and SHA-512, operating on 64-bit words).

SHA-256 Processing Pipeline

For SHA-256, the internal state consists of eight 32-bit words, denoted a, b, c, d, e, f, g, and h, initialized to specific constants derived from the fractional parts of the square roots of the first eight prime numbers (2 through 19):

  • State: H(0) = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19}

For each 512-bit message block:

  1. Message Schedule Expansion: The 16 words of the message block W0, ..., W15 are expanded into 64 words W0, ..., W63 using bitwise rotation (ROTR), right shift (SHR), and non-linear combination:

sigma0(x) = ROTR7(x) ⊕ ROTR18(x) ⊕ SHR3(x) sigma1(x) = ROTR17(x) ⊕ ROTR19(x) ⊕ SHR10(x) Wt = sigma1(Wt−2) + Wt−7 + sigma0(Wt−15) + Wt−16 (mod 232)

  1. Compression Rounds: The state executes 64 iterative compression rounds. Each round incorporates a round constant Kt (derived from the cube roots of the first 64 prime numbers) and evaluates two non-linear boolean functions:

Ch(e, f, g) = (e ∧ f) ⊕ (¬e ∧ g) (the Choice function) Maj(a, b, c) = (a ∧ b) ⊕ (a ∧ c) ⊕ (b ∧ c) (the Majority function) Sigma0(a) = ROTR2(a) ⊕ ROTR13(a) ⊕ ROTR22(a) Sigma1(e) = ROTR6(e) ⊕ ROTR11(e) ⊕ ROTR25(e)

T1 = h + Sigma1(e) + Ch(e, f, g) + Kt + Wt T2 = Sigma0(a) + Maj(a, b, c)

The state words update according to: h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2 (mod 232)

  1. Feed-Forward Addition: After 64 rounds, the resulting working variables are added to the previous state (H(i) = H(i−1) + State), satisfying the Davies–Meyer construction.

The SHA-3 Paradigm: Keccak Sponge Architecture

SHA-3 departs fundamentally from the mathematical machinery of SHA-2. It operates on an internal state of 1600 bits arranged as a 5 × 5 array of 64-bit lanes, evaluated using the Keccak-p[1600, 24] permutation.

The permutation applies 24 rounds consisting of five modular mappings:

  • theta: A linear mixing step that diffuses bit parity across adjacent columns.
  • rho: Transposes bits within each 64-bit lane by fixed rotation offsets.
  • pi: Permutes the positions of the 25 lanes across the 5 × 5 grid.
  • chi: The sole non-linear component, combining each bit with a non-linear function of two adjacent bits along its row (providing algebraic degree two).
  • iota: Injects round constants to break circular structural symmetries.

Because SHA-3 does not follow the Merkle–Damgård paradigm, it is structurally immune to length-extension attacks without requiring HMAC encapsulation. Furthermore, SHA-3 standardizes Extendable-Output Functions (XOFs), termed SHAKE128 and SHAKE256, which can produce arbitrary-length output digests.

Technical Comparison of Standardized SHA Functions

AlgorithmOutput Digest (bits)Internal State (bits)Block Size (bits)Max Message Size (bits)Collision Security Bound
SHA-1160160512264 − 1Broken (~263)
SHA-256256256512264 − 12128 operations
SHA-51251251210242128 − 12256 operations
SHA3-25625616001088 (bitrate r)Unlimited2128 operations
SHA3-5125121600576 (bitrate r)Unlimited2256 operations

References

  1. National Institute of Standards and Technology (US). (2015). Secure Hash Standard (SHS). Federal Information Processing Standards Publication 180-4.
  2. National Institute of Standards and Technology (US). (2015). SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions. Federal Information Processing Standards Publication 202.
  3. Stevens, M., Bursztein, E., Karpman, P., Albertini, A., & Markov, Y. (2017). The first collision for full SHA-1. Advances in Cryptology — CRYPTO 2017, 570-596.
  4. Bertoni, G., Daemen, J., Peeters, M., & Van Assche, G. (2013). Keccak. Advances in Cryptology — EUROCRYPT 2013, 313-314.
🧬 Support Open Science
Explore interactive science games on LowKey Games or browse scientific apparel & accessories in the CRV Science Shop.
💡 Spot an inaccuracy or have primary literature to expand this article?
Submit a citation or revision note using your shared CRV Science / LowKey Games profile ID.
Suggest Revision