Second Preimage Resistance
What you'll learn: You'll understand why a secure hash function must make it computationally infeasible to find a different input that produces the same hash as a given input.
Core Concept
In the previous lesson, you learned about preimage resistance (one-wayness) — given a hash, you can't find any input that produces it. Second preimage resistance is a related but distinct property: given a specific input and its hash, an attacker shouldn't be able to find a different input that produces the same hash.
Think of it like this: You sign a digital contract by hashing it. Second preimage resistance ensures that once you've committed to that specific document, no one can craft a slightly different document (maybe changing payment terms) that produces the identical hash. Without this property, someone could substitute your contract with a malicious version that shares your signature.
Why This Matters
Unlike preimage resistance where the attacker starts with just a hash value, here they have both the original message and its hash. This gives them more information to work with, yet finding a collision must still be infeasible.
This property protects digital signatures, file integrity checks, and commitment schemes. If an attacker could find a second preimage, they could:
- Replace legitimate software with malware that passes hash verification
- Alter signed documents while maintaining valid signatures
- Break cryptocurrency transaction integrity
The Distinction
- Preimage resistance: Given
H(m), find anym - Second preimage resistance: Given
mandH(m), find a differentm'whereH(m') = H(m)
Key Takeaway: Second preimage resistance ensures that given a specific message and its hash, finding another message with the same hash remains computationally infeasible — critical for protecting signed or committed data from targeted substitution attacks.