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
Compare preimage resistance, second preimage resistance, and collision resistance through their different attacker goals. section 6.2

