Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Let[m]denote the set{0,1,,m1}. For each of the following families of hash functions, say whether or not it is universal, and determine how many random bits are needed to choose a function from the family.

(a) H={ha1,a2:a1,a2[m]}, wheremis a fixed prime and

ha1·ha1,a2(x1,x2)=a1x1+a2x2modm

Notice that each of these functions has signatureha1,a2:[m]2[m]that is, it maps a pair of integers in[m]to a single integer in[m].

(b) His as before, except that nowm=2kis some fixed power of.2

(c) His the set of all functionsf:[m][m1].

Short Answer

Expert verified

a) It is proved that given family of hash functions,His universal.

b) It is required to choose two integers, the total number of random bits required to select a hash function is2kbits.

c) mlog(m1)bits required to choose a function fromH.

Step by step solution

01

To prove that the family of hash function His universal

(a)

H={ha1,a2:a1,a2[m]}andha1,a2=i=12ai.ximodm=(a1x1+a2x2modm)

Assume thatx2y2.

Now, to proveH={ha1,a2:a1,a2[m]}is universal, it is required to find the probability

Pr[ha1,a2(x1,x2)=ha1,a2(y1,y2)]

Re write the above equation as follows:

a1(x1y1)a2(y2x2)modm

Selecta1randomly from[m] and assumec=a1(x1y1).

Thena2c.(y2x2)1modm,

Now calculate the probability of selectingso that Equation(1)is true.

Thusa2c.(y2x2)1modmand obviouslycan be any one of the integers in.{0,1,,m1} That isa2,havepossible values.

Therefore, the probability of equation (1)holds is1m.

Hence it is proved that given family of hash functions,His universal.

02

Total number of random bits required to select a hash function is2k bits

(b)

Consider a family of hash functionsH={ha1,a2:a1,a2[m]} and

ha1,a2=i=12ai.ximodm=a1x1+a2x2modm

Wherem=2k(That is,mis even).

From part (a)H,is universal and(a1x1+a2x2)(a1y1+a2y2)modmholds when there exists a unique inverse modulomfor (y2x2).

There will be a unique inverse modulomfor (y2x2), only ifmis a prime number.

Sincem=2kand it is not a prime number (unlessk=1), there exist no unique inverse modulomfor.

(y2x2)

ThusH,is not universal.

In order to select a hash function randomly from,H need to select two integers

a1and a2randomly from.[m] The set [m]has totalintegers.

To uniquely represent each number in set,[m] at mostlogmbits are required

Where,

logmbits=log2k=kbits.

Since it is required to choose two integers, the total number of random bits required to select a hash function is2k bits.

03

mlog(m−1)bits required to choose a function from HH

(c)

Consider a family of hash functionsf:[m][m1].

In order to prove the above family of hash functions is universal, it is enough to prove that the probability of colliding any two data itemsxand yis1m1, if the hash function is randomly chosen from the family of hash functions. Wherem1is the number of buckets.

Assumexyand then calculateP=Pr[f(x)=f(y)].

The probability forf(x) can be any one of integers of[m1] is1m1.

Similarly, the probability forf(y)can be any one of integers of [m1]is.1m1

The probability for the outputs off(x)and f(y)are same is.data-custom-editor="chemistry" 1m1×1m1=1(m1)2

However, there arem1ways to be.f(x)=f(y)

That is(f(x)=0,1,2,,m2)=(f(y)=0,1,2,m2),(totalm1ways)

Thus,P=i=1m11(m1)2

or

P=(m1)×1(m1)2P=1m1

Therefore, it is proved thatHis universal.

Set [m]={0,1,2,,m1}can be mapped to set [m1]={0,1,2,,m2}in(m1)mways such that fis a function.

Thus, the total number of functions f:[m][m1]is(m1)m.

To uniquely represent each function inH, at most log(m1)m=mlog(m1)bits are required.

Therefore,mlog(m1)bits required to choose a function fromH.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Study anywhere. Anytime. Across all devices.

Sign-up for free