Example of a Hash function which is second pre-image resistant but not collision resistant We know that a collision resistant hash function is also second pre-image resistant. But the converse is not necessarily true.
I am looking for the example of a hash function which is second pre-image resistant but not collision resistant. Please help.
Let $H$ be a collision resistant hash function. This implies that it is also second preimage resistant.
Let $x_0,x_1$ be two arbitrary values from the domain of the hash function. We define the new hash function $$H'(x):=\begin{cases}H(x)&amp; \text{if }x\neq x_0\\H(x_1)&amp;\text{if }x=x_0\end{cases}.$$
This hash function is trivially not collision resistant, just output $x_0,x_1$. However, it remains second preimage resistant via a simple reduction.