@vourdalak
2019-05-03T12:45:46.000000Z
字数 1549
阅读 625
CS161
Use the divide-and-conquer algorithm, from Section 11.2, to compute 10110011·10111010 in binary. Show your work.
Use Karatsuba multiplication.
(calculate from the same way, divide-and-conquer)
Show the execution of method FastExponentiation(5, 12, 13) by constructing a table similar to Table 24.6.
| p | 12 | 6 | 3 | 1 | 0 |
|---|---|---|---|---|---|
| r | 1 | 12 | 8 | 5 | 1 |
Write a nonrecursive version of Algorithm ExtendedEuclidGCD.
def ExtendedEuclidGCD(a,b):if b == 0:return (a, 1, 0)x1 = 0x2 = 1y1 = 1y2 = 0while b > 0:q = a // br = a - q * bx = x2 - q * x1y = y2 - q * y1a = bb = rx2 = x1x1 = xy2 = y1y1 = yd = ax = x2y = y2return (d,x,y)
Output:
print(ExtendedEuclidGCD(175,20))> (5, -1, 9)
Suppose the primes p and q used in the RSA cryptosystem, to define , are in the range [ ]. Explain how you can efficiently factor using this information.
The size of the range is . For each composite number n, there is a range of to be checked. For each n, we calculate and , and then look for prime numbers in the range. Once we have the list of possible prime numbers we multiply them pair by pair to see if the product is n.
As n becomes larger and larger (especially RSA mostly uses very large integers), the range to be searched in ()will become quite large. And determining prime numbers in this range one by one can be difficult too. For a number as large as a normal RSA, I don't think it will be possible to use such range information to factor the number.