{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# sol2 - CS346 Cryptography Fall 2009 Homework 2 SOLUTIONS...

This preview shows pages 1–2. Sign up to view the full content.

CS346 Cryptography, Fall 2009 Homework 2, SOLUTIONS 1. (5 points) Give an algorithm that on input integers x and m computes x 37 mod m . As a primitive step you may assume an algorithm for modular multiplication: on input y and z it computes ( y · z ) mod m . Your algorithm should use as few modular multiplications as possible (7 is the best possible). You may write the algorithm informally. Solution: x 2 = x × x (mod m ) x 4 = x 2 × x 2 (mod m ) x 8 = x 4 × x 4 (mod m ) x 16 = x 8 × x 8 (mod m ) x 32 = x 16 × x 16 (mod m ) x 36 = x 32 × x 4 (mod m ) x 37 = x 36 × x (mod m ) Note that x i = x i (mod m ) 2. (6 points) Find the greatest common divisors of the following pairs, without factoring. Use the Euclidean algorithm instead. For each pair, give the sequence of r i -s produced by the algorithm. NOTE: you should be able to do this by hand, without a computer or calculator. A. gcd (103927 , 102313) Solution: r 0 = 103927, r 1 = 102313, r 2 = 1614, r 3 = 631, r 4 = 352, r 5 = 279, r 6 = 73, r 7 = 60, r 8 = 13, r 9 = 8, r 10 = 5, r 11 = 3, r 12 = 2, r 13 = 1, r 14 =1, r 15 = 0. So, gcd(103927 , 102313) = r 14 = 1.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}