Second pre-image resistance
Second pre-image resistance is the property that, given an input and its hash, finding a different input with the same hash is computationally infeasible.
Real-World Cryptography
Second pre-image resistance is the property that, given an input and its hash output, it is computationally infeasible to find a different input with the same output.
- How it is used
- Protects file integrity, signed transactions, and authenticated key-exchange values from substitution attacks.
- How deep it goes
- Defines the threat model, contrasts related properties, and demonstrates encoding and digest-size failure modes without proving hash internals.
- Examples
- Uses downloaded files, SHA-256 commands, ambiguous transactions, TupleHash encoding, and truncated short authenticated strings.
- What you can do after
- Diagnose substitution risks by checking digest size, trustworthy digest distribution, and unambiguous serialization before hashing.
Read how Real-World Cryptography explains second pre-image resistance →
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.
- How it is used
- Uses hash functions to prevent replacing a known input with a different input that preserves its digest.
- 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.
Read how Hacking Cryptography explains second pre-image resistance →
Related concepts
- hash functionproduced by · A hash function deterministically maps input data to a value in a bounded output range, commonly for indexing, lookup, comparison, or integrity checking.
- security propertykind of · A security property is a security-relevant characteristic that a cryptographic primitive or protocol is intended to provide.
- pre-image resistancecontrasts with · Pre-image resistance is the property that it is computationally infeasible to find an input producing a specified hash output.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

