liveBook · Manning

Second pre-image resistance

As explained in Hacking Cryptography

The property that, given an input and its hash output, it is computationally infeasible to find a different input with the same hash output.

Second preimage resistance is the requirement that, given a known input A and digest Y = H(A), finding a different input B with H(B) = Y is computationally infeasible. It protects a specific existing message or password from being replaced by another with the same hash. section 6.2 section 6.5

Distinguish this property from related hash-function guarantees:

  • Preimage resistance hides the original A when only H(A) is known. section 6.2
  • Second preimage resistance prevents finding any different B matching the digest of a fixed A. section 6.2
  • Collision resistance concerns finding any pair of inputs with the same digest, without fixing either input first. section 6.2

Password replacement

If a password database stores Y = H(A), an attacker should not be able to construct another password B that produces the same Y. Fixed-size hashes inevitably permit theoretical collisions because unlimited inputs map into bounded outputs; the security goal is making useful matches infeasible to find. section 6.2 section 6.5

Figure 6.4 Security properties of hash functions
figure

Compare preimage resistance, second preimage resistance, and collision resistance through their different attacker goals. section 6.2

How Hacking Cryptography covers it

How deep it goes
Defines the attacker’s fixed-input goal and contrasts it with preimage and collision resistance, but gives no construction or attack procedure.
Examples
Uses password hashes and bounded-output mappings to illustrate fixed-input substitution and inevitable theoretical collisions.
What you can do after
Evaluate hash-function guarantees by identifying whether an attack fixes one input or searches for any matching pair.
How it connects
Connects second preimage resistance to hash functions, preimage resistance, collision resistance, and the pigeonhole principle.

Also explained in

Compare how 2 books explain second pre-image resistance →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Hacking Cryptography. The section links point to the parts of the book it draws on.