10.12.2012 Views

Prime Numbers

Prime Numbers

Prime Numbers

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

252 Chapter 5 EXPONENTIAL FACTORING ALGORITHMS<br />

for some integer k ∈ [0,d− 1], where d =gcd(a, n) andu is a solution to the<br />

extended-Euclid relation au + nv = d.<br />

This exercise shows that finding a logarithm for a nontrivial power of t is,<br />

if d is not too large, essentially equivalent to the original DL problem.<br />

5.5. Suppose G is a finite cyclic group, you know the group order n, and<br />

you know the prime factorization of n. Show how the Shanks baby-steps,<br />

giant-steps method of Section 5.3 can be used to solve discrete logs in G in<br />

O √ p ln n operations, where p is the largest prime factor of n. Give a similar<br />

bound for the space required.<br />

5.6. As we have seen in the chapter, the basic Shanks baby-steps, giantsteps<br />

procedure can be summarized thus: Make respective lists for baby steps<br />

and giant steps, sort one list, then find a match by sequentially searching<br />

through the other list. As we know, solving g l = t (where g is a generator of<br />

the cyclic group of order n and t is an element) can be effected in this way<br />

in O(n 1/2 ln n) operations (comparisons). But there is a so-called hash-table<br />

construction that heuristically alters this complexity (albeit slightly) and in<br />

practice works quite efficiently. A summary of such a method runs as follows:<br />

(1) Construct the baby-step list, but in hash-table form.<br />

(2) On each successive giant step look up (rapidly) the corresponding hashtable<br />

entry, seeking a match.<br />

The present exercise is to work through—by machine—the following example<br />

of an actual DL solution. This example, unlike the fundamental Algorithm<br />

5.3.1, uses some tricks that exploit the way machines tend to function,<br />

effectively reducing complexity in this way. For the prime p =2 31 − 1and<br />

an explicitly posed DL problem, say to solve<br />

g l ≡ t (mod p),<br />

we proceed as follows. Reminiscent of Algorithm 5.3.1 set b = ⌈ √ p⌉, but<br />

in addition choose a special parameter β =2 12 to create a baby-steps “hash<br />

table” whose r-th row, for r ∈ [0,β−1], consists of all those residues g j mod p,<br />

for j ∈ [0,b−1], that have r =(g j mod p) modβ. That is, the row of the hash<br />

table into which a power g j mod p is inserted depends only on that modular<br />

power’s low lg β bits. Thus, in about √ p multiplies (successively, by g) we<br />

construct a hash table of β rows. As a check on the programming effort, for a<br />

specific choice g =7the(r = 1271)-th row should appear as<br />

((704148727, 507), (219280631, 3371), (896259319, 4844) ...),<br />

meaning, for example,<br />

7 507 mod p = 704148727 = (...010011110111)2,<br />

7 3371 mod p = 219280631 = (...010011110111)2,<br />

and so on. After the baby-steps hash table is constructed, you can run through<br />

giant-step terms tg −ib for i ∈ [0,b− 1] and, by inspecting only the low 12 bits

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!