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

Most popular questions from this chapter

1.38. To see if a number, say 562437487, is divisible by 3, you just add up the digits of its decimalrepresentation, and see if the result is divisible by role="math" localid="1658402816137" 3.

( 5+6+2+4+3+7+4+8+7=46, so it is not divisible by 3).

To see if the same number is divisible by 11, you can do this: subdivide the number into pairs ofdigits, from the right-hand end(87,74,43,62,5) , add these numbers and see if the sum is divisible by11 (if it's too big, repeat).

How about 37? To see if the number is divisible by 37, subdivide it into triples from the end(487,437,562) add these up, and see if the sum is divisible by37 .


This is true for any prime pother than2 and 5. That is, for any prime p≠2,5, there is an integer rsuch that in order to see ifp divides a decimal number n, we breakn into r-tuples of decimal digits (starting from the right-hand end), add up these r-tuples, and check if the sum is divisible by p.

(a) What is the smallest rsuch for p=13? Forp=13 ?

(b) Show thatr is a divisor of p-1.

Digital signatures, continued.Consider the signature scheme of Exercise 1.45.

(a) Signing involves decryption, and is therefore risky. Show that if Bob agrees to sign anything he is asked to, Eve can take advantage of this and decrypt any message sent by Alice to Bob.

(b) Suppose that Bob is more careful, and refuses to sign messages if their signatures look suspiciously like text. (We assume that a randomly chosen messagethat is, a random number in the range{1,...,N-1} is very unlikely to look like text.) Describe a way in which Eve can nevertheless still decrypt messages from Alice to Bob, by getting Bob to sign messages whose signatures look random.

Consider the problem of computing N!=1·2·3···N.

(a) If Nis an role="math" localid="1658397956489" n-bit number, how many bits long is N!, approximately ( inΘ(·)form)?

(b) Give an algorithm to compute N!and analyze its running time.

Show that any binary integer is at most four times as long as the corresponding decimal integer. For very large numbers, what is the ratio of these two lengths, approximately?

Show that log(n!)=θ(nlogn)

(Hint: To show an upper bound, compare (n!) with nn. To show a lower bound, compare it with (n2)n2).

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free