Docsity

Homework 1 - Cryptography and Network Security | CS 549, Assignments of Cryptography and System Security

Toggle sidebar
bg1
Homework 1 of CS549 Cryptography and Network Security
Assigned: Jan. 30th, 2009 Due Date: Feb. 23rd, 2009
Extension Date (with 10% deduction on grading): 5PM, March 2nd, 2009
Spring 2009, CS Department, IIT
1. Prove that a−1mod nexists if and only if gcd(a, n) = 1.
2. Find the smallest positive integer xsuch that x·4321 = 1 mod 2007.
3. What is the value of 72007 mod 13?
4. Suppose that n=p·qwith p,qdifferent primes. Suppose also that n= 4,386,607 and φ(n) =
4,382,136. Find p,q.
5. Find the smallest integer x > 0 such that 13 ·x= 4 mod 99 and 7 ·x= 5 mod 101 are satisfied
simultaneously.
6. Given an integer n=p1·p2·p3, where p1,p2and p3are prime numbers larger than 2, prove that there
are exactly 8 integers x∈[1, n] satisfying
x2= 1 mod n.
7. Let integer pbe an odd prime number and pdoes not divide b. Then prove the following statements
(a) bis a quadratic residue of pif and only if bp−1
2= 1 mod p.
(b) bis a quadratic non-residue of pif and only if bp−1
2=−1 mod p.
8. This question is about solving the quadratic congruence. Assume that p > 2 is a prime number and the
positive integer a=x2mod pfor some unknown integer x∈[1, p −1]. Prove the following statements
(a) (5 points) There are only two solutions (i.e., two integers in [1, p −1])for equation a=x2mod p.
(b) (5 points) If p= 3 mod 4, then x1=ap+1
4mod p, and x2=p−x1are the only two solutions.
(c) (5 points) If p= 5 mod 8 and ap−1
4= 1 mod p, then x1=ap+3
8mod p, and x2=p−x1are the
only two solutions.
(d) (5 points) If p= 5 mod 8 and ap−1
4=−1 mod p, then x1= 2a·(4a)p−5
8mod p, and x2=p−x1
are the only two solutions.
Hint: (1) notice that ap−1
2= 1 mod p; (2) notice that 2 is a quadratic non-residue mo dulo p, if p= 5
mod 8, i.e., there is no integer tsuch that t2= 2 mod pif p= 5 mod 8; (3) an integer bis a quadratic
residue modulo piff bp−1
2= 1 mod p.
9. An affine cipher encrypts a plaintext x∈[0,255] as y=k1x+k2mod 256. A key (k1, k2) with
0≤k1, k2≤255 is valid for an affine cipher if the function k1x+k2mod 256 is an one-to-one
mapping. How many different valid keys for this affine cipher?
10. Write a code to compute abmod n, when given integer a > 0, b > 0, and n > 0.
Here the input integers could be up to 1000 bits. So your code should be able to take care of big
integers.
Use your code to find what is the last digit of the following number abmod n, when a= 2123 −1,
b= 2999 −1, and n= 2345 + 1.

Partial preview of the text

Download Homework 1 - Cryptography and Network Security | CS 549 and more Assignments Cryptography and System Security in PDF only on Docsity!

Homework 1 of CS549 Cryptography and Network Security

Assigned: Jan. 30th, 2009 Due Date: Feb. 23rd, 2009 Extension Date (with 10% deduction on grading): 5PM, March 2nd, 2009 Spring 2009, CS Department, IIT

  1. Prove that a−^1 mod n exists if and only if gcd(a, n) = 1.
  2. Find the smallest positive integer x such that x · 4321 = 1 mod 2007.
  3. What is the value of 7^2007 mod 13?
  4. Suppose that n = p · q with p, q different primes. Suppose also that n = 4, 386 , 607 and φ(n) = 4 , 382 , 136. Find p, q.
  5. Find the smallest integer x > 0 such that 13 · x = 4 mod 99 and 7 · x = 5 mod 101 are satisfied simultaneously.
  6. Given an integer n = p 1 · p 2 · p 3 , where p 1 , p 2 and p 3 are prime numbers larger than 2, prove that there are exactly 8 integers x ∈ [1, n] satisfying

x^2 = 1 mod n.

  1. Let integer p be an odd prime number and p does not divide b. Then prove the following statements

(a) b is a quadratic residue of p if and only if b

p− 1 (^2) = 1 mod p.

(b) b is a quadratic non-residue of p if and only if b

p− 1 (^2) = − 1 mod p.

  1. This question is about solving the quadratic congruence. Assume that p > 2 is a prime number and the positive integer a = x^2 mod p for some unknown integer x ∈ [1, p − 1]. Prove the following statements

(a) (5 points) There are only two solutions (i.e., two integers in [1, p − 1])for equation a = x^2 mod p. (b) (5 points) If p = 3 mod 4, then x 1 = a

p+ (^4) mod p, and x 2 = p − x 1 are the only two solutions.

(c) (5 points) If p = 5 mod 8 and a

p− 1 (^4) = 1 mod p, then x 1 = a p+ (^8) mod p, and x 2 = p − x 1 are the only two solutions. (d) (5 points) If p = 5 mod 8 and a

p− 1 (^4) = − 1 mod p, then x 1 = 2a · (4a) p− 5 (^8) mod p, and x 2 = p − x 1 are the only two solutions.

Hint: (1) notice that a

p− 1 (^2) = 1 mod p; (2) notice that 2 is a quadratic non-residue modulo p, if p = 5 mod 8, i.e., there is no integer t such that t^2 = 2 mod p if p = 5 mod 8; (3) an integer b is a quadratic residue modulo p iff b p− 2 1 = 1 mod p.

  1. An affine cipher encrypts a plaintext x ∈ [0, 255] as y = k 1 x + k 2 mod 256. A key (k 1 , k 2 ) with 0 ≤ k 1 , k 2 ≤ 255 is valid for an affine cipher if the function k 1 x + k 2 mod 256 is an one-to-one mapping. How many different valid keys for this affine cipher?
  2. Write a code to compute ab^ mod n, when given integer a > 0, b > 0, and n > 0.

Here the input integers could be up to 1000 bits. So your code should be able to take care of big integers. Use your code to find what is the last digit of the following number ab^ mod n, when a = 2^123 − 1, b = 2^999 − 1, and n = 2^345 + 1.