29.1k views
3 votes
Assume Bob has designed a hash function as follows: His function gets the data to be hashed. Then, he flips a coin 256 times, so he generates a string of Hs (Heads) and Ts (Tails). He replaces H with 1 and T with 0. After that, he writes the data along with the generated binary string which is 256 bits long in a database. Next time, his function searches the data first. If it finds the data inside the database, it immediately returns its binary string, otherwise, it will repeat the process of flipping the coin. Based on the different features that a cryptographic hash function should have , explain if this function is a proper hash function or not ? Examine at least THREE features

User Khayk
by
7.1k points

1 Answer

3 votes

Final answer:

Bob's hash function is not proper because it fails to provide determinism, collision resistance, and pre-image resistance which are essential features of a cryptographic hash function.

Step-by-step explanation:

The hash function proposed by Bob is not a proper cryptographic hash function. Cryptographic hash functions should satisfy several important features to ensure security and functionality.

One such feature is determinism, meaning that the same input should always produce the same hash value. Bob's hash function fails this because it flip coins every time an input is given that isn't in the database, potentially giving different hash values for the same input.

Another feature is collision resistance, which implies that it should be hard to find two different inputs that produce the same hash value. Since Bob's function relies on random coin flips, there's a non-negligible chance that two different inputs can result in the same sequence of heads and tails, leading to the same hash value.

The final feature is pre-image resistance, which means that given a hash value, it should be difficult to find the original input. Bob's hash function stores the original data in a database, which lacks the one-way nature of a proper hash function, making it fail the pre-image resistance test.

User Marcz
by
7.6k points