When a hash must resist collisions, pre-image attacks, and second pre-image attacks—and avoid length-extension attacks—SHA-3 offers a modern standardized choice. It is based on Keccak’s sponge construction rather than the Merkle–Damgård construction used by SHA-2. section 2.5.2 section 2.7
A high-level SHA-3 computation proceeds through these ideas:
- Start with a reversible permutation, keccak-f, which maps a state to another state of the same size. section 2.5.2
- Split the permutation state into a rate and a capacity, then absorb input by XORing blocks into the rate and permuting repeatedly. section 2.5.2
- Squeeze the digest by repeatedly permuting the state and retrieving as much rate as the requested output requires. section 2.5.2
Choosing a SHA-3 variant
SHA-3-256 produces a 256-bit digest; the standardized family also includes SHA-3-224, SHA-3-384, and SHA-3-512. section 2.5.2
Figure 2.6 SHA-2 and SHA-3, the two most widely adopted hash functions. SHA-2 is based on the Merkle–Damgård construction, while SHA-3 is based on the sponge construction.
Use the comparison diagram to distinguish SHA-3’s sponge construction from SHA-2’s Merkle–Damgård construction. section 2.5


