1
$\begingroup$

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.

$\endgroup$
1
  • 5
    $\begingroup$ SHA-1 and MD5 are examples. $\endgroup$ – kelalaka May 5 at 10:37
3
$\begingroup$

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)& \text{if }x\neq x_0\\H(x_1)&\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.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.