Course contentsShow
← Security
Lesson 210 of 3,0525. Cryptographic Hashing and MACsFree lesson

SHA-3 and the Keccak Algorithm

Learning about SHA-3, its sponge construction, and how it differs fundamentally from SHA-2.

SHA-3 and the Keccak Algorithm

What you'll learn: How SHA-3 uses a fundamentally different internal design called the "sponge construction" compared to SHA-2's Merkle-Damgård approach.

Why SHA-3 Exists

After theoretical attacks weakened MD5 and SHA-1, NIST wanted a backup plan in case SHA-2 ever fell. In 2015, they standardized SHA-3 based on the winning Keccak algorithm from a public competition—not because SHA-2 was broken, but as a safety net with completely different mathematics.

The Sponge Construction

Unlike SHA-2's sequential "compression function" design, SHA-3 uses a sponge construction—imagine a sponge that absorbs water, then squeezes it back out:

  1. Absorbing phase: Your input data is XORed into part of SHA-3's internal state (the "rate") in blocks, while another part (the "capacity") remains untouched for security
  2. Permutation: After each block, the entire state undergoes a complex scrambling function called Keccak-f
  3. Squeezing phase: Once all input is absorbed, you "squeeze" output bits from the rate portion until you have the desired hash length

This design is more flexible—the same core algorithm produces SHA3-224, SHA3-256, SHA3-384, SHA3-512, and even extendable-output functions (XOFs) like SHAKE128 and SHAKE256.

Key Differences from SHA-2

  • No length padding vulnerabilities: The sponge construction naturally avoids certain extension attacks
  • Different mathematical foundation: Based on bit permutations rather than modular arithmetic
  • Flexibility: Can generate arbitrary-length outputs with SHAKE variants
  • Performance trade-offs: Often slower in software than SHA-2, but efficient in hardware

Key Takeaway: SHA-3 is a fundamentally different hash function family based on the Keccak sponge construction, providing cryptographic diversity as a backup to SHA-2 rather than a replacement for a broken algorithm.