What Is a ‘Pre-Image Attack’ and How Does It Relate to Collision Resistance?
A pre-image attack is an attempt to find the original input data (the pre-image) that produced a given hash output. There are two types: first pre-image resistance (finding the input for a known hash) and second pre-image resistance (finding a different input that produces the same hash as a known input).
Collision resistance is a stronger property, requiring it to be hard to find any two inputs that hash to the same output. SHA-256 is designed to be resistant to all three.