Question: string some_hash(const string& input) { string retval = x0fxffx00; for (size_t i = 0; i < input.length(); ++i) { retval[0] ^= input[i]; retval[1] &= input[i];
string some_hash(const string& input) { string retval = "\x0f\xff\x00"; for (size_t i = 0; i < input.length(); ++i) { retval[0] ^= input[i]; retval[1] &= input[i]; retval[2] |= input[i]; } return retval; } Show that some hash is not suitable as a cryptographic hash function, by giving an example collision and a method to generate second-preimages for any arbitary value.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
