I'm trying to understand the relationship between preimage resistance and second preimage resistance. Consider the following example.
Suppose there exists a hash function H(x). The function produces k-bit hash codes, and is collision resistant, preimage resistance, and second preimage resistance.
Then suppose there exists a hash function H'(x). The function produces (k+1) bit hash codes. When x is k bit long, the output is 0||x. When x is not k bit long the output is 1||H(x).
What resistances does H'(x) have and nor have, and why?