Question: Implement the following Universal hash function in Java. universalHash(int m) {Pick a random prime number p in the range [m, 2m]. Pick two distinct random

 Implement the following Universal hash function in Java. universalHash(int m) {Pick

Implement the following Universal hash function in Java. universalHash(int m) {Pick a random prime number p in the range [m, 2m]. Pick two distinct random integers a, b in the range [1, p]. Output the (a, b, p, m) We compute the hash value h(k) for a key k using the hashValue() algorithm. hashValue(int k, int (a, b, p, m)){- return ((ak + b)%p)%m.} Let m = 2^30 and set of keys are all integers in the interval [2^60, 2^63 - 1]. Find a collision (i.e. find two distinct keys k_1 notequalto k_2 in the interval such that h(k_1) = h(k_2). Also computes the number of tries (counter) before you find a collision.^1 Print out values (k_1, k_2, counter, (a, b, p, m)) and submit with your codes. What is the probability that two randomly distinct keys will hash to the same value.^1 One way to find the collision is to pick two distinct random keys k_1 and k_2 from the interval [1, 2^60 - 1] and then test if h(k_1) = h(k_2). However there is a smarter way of finding a collision

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!