# Example: pre-image resistance to second pre-image resistance

It is possible to convert a pre-image resistant function $f:\{0,1\}^{n}\rightarrow \{0,1\}^{n}$ to a second-preimage resistant function? I am thinking to use a pseudo-random generator and construct that second pre-image resistant function in this way:

$$F(x)=f(x)+\text{PRNG}(x).$$

What kind of tests I need to make to verify this function is second-preimage resistant?

• Just let me quickly recap this: $f$ is pre-image resistant and $F$ should be pre-image resistant and second pre-image resistant? – SEJPM Jul 26 '15 at 13:01
• @SEJPM Yes it is – juaninf Jul 26 '15 at 13:06
• – otus Jul 26 '15 at 13:30
• @mikeazo The length preservation indeed makes things a bit trivial. to "convert" just ignore the function and use the identity function instead (or any other permutation for that matter). Since there is only one preimage for each image, there can be no second preimage attack. – Maeher Jul 29 '15 at 16:04
• @Maeher but with the identity function, you don't have preimage resistance. – mikeazo Jul 29 '15 at 16:23