Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Q4 Bob believes that he has come up with a nifty hash function. He assigns a num

ID: 3740982 • Letter: Q

Question

Q4       Bob believes that he has come up with a nifty hash function. He assigns a numeric value VCharto each letter in the alphabet equal to the letter’s position in the alphabet, i.e., VA= 1, VB= 2, …, VZ= 26. For a message, he calculates the hash value H = (VChar 1 x VChar 2 x VChar 3 …x VChar N) mod(26).

Bob uses this function to send a one-word message, GLARE, to his banker Bill, along with his calculated hash value for the message. Alice is able to intercept the message, and generates an alternative message that has a hash value that collides with Bob’s original hash value.

Give definition and properties of the hash function.

Show a message that Alice may have used to spoof Bob’s message, and demonstrate that its hash value collides with Bob’s original hash.

Explanation / Answer

Hash Function is a function that takes input as a string or message and ouputs a fixed size alphanumeric string or cipher text.

The security properties of hash function should be :

1. Preimage resistance: For a given output z, it is impossible to find any input x such that h(x) = z, i.e., h(x) is one- way.

2. Second preimage resistance: Given x1, and thus h(x1), it is computationally infeasible to find any x2 such that h(x1) = h(x2).

3. Collision resistance: It is computationally infeasible to find any pairs x1 ? x2 such that h(x1) = h(x2).

Here, Bob assigns a numeric value to each alphabets, i.e. A=1, B=2, C=3, ........ , Z=26.

Then, hash value H = (VChar 1 x VChar 2 x VChar 3 …x VChar N) mod(26).

For e.g.  GLARE : G=7, L=12, A=1, R=18, E=5

Therefore, hash value H = (7*12*1*18*5)mod(26) = 20

Also , hash value of string "T" = 20

Hence, the used hash function is not second preimage resistance as H(GLARE) = H(T).

Alice may have used message "T" to spoof Bob’s message as their hash value collides.