This question deals with a "one-way" function $h$. Then, given the value $y = h(x)$, it is computationally infeasible to find $x$ directly from $y$.
(a) Suppose that Peter computes $y = h(x)$, where $x$ is Peter's salary, in Ringgits. If John obtains $y$, how can he determine Peter's salary $x$? (Hint: Adapt the forward search attack to this problem).
How do I explain the attack just by using cryptanalysis and forward search attack?
(b) Why does your attack not violate the one-way property of $h$?
Assuming he used forward search attack does not violate the one way property of $h$?
(c) How could Peter prevent this attack? We assume that John has access to the output of the function $h$, John knows that the input includes Peter's salary, and John knows the format of the input. Also, no keys are available, so Peter cannot encrypt the output value.
Second pre-image resistant to prevent this attack?