Assignment 3 solutions
This presentation is the property of its rightful owner.
Sponsored Links
1 / 25

Assignment #3 Solutions PowerPoint PPT Presentation


  • 50 Views
  • Uploaded on
  • Presentation posted in: General

Assignment #3 Solutions. January 24, 2006. Problem #1. Use Fermat’s Little Theorem and induction on k to prove that x k ( p –1)+1 mod p = x mod p for all primes p and k ≥ 0. Answer #1. By induction on k … Base case k = 0 :

Download Presentation

Assignment #3 Solutions

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Assignment 3 solutions

Assignment #3Solutions

January 24, 2006


Problem 1

Problem #1

Use Fermat’s Little Theorem and induction on k to prove that

xk(p–1)+1 mod p = x mod p

for all primes p and k ≥ 0.

Practical Aspects of Modern Cryptography


Answer 1

Answer #1

By induction on k …

Base case k = 0:

xk(p–1)+1 mod p = x0+1 mod p = x mod p

Base case k = 1:

xk(p–1)+1 mod p = x(p-1)+1 mod p

= xp mod p = x mod p

(by Fermat’s Little Theorem)

Practical Aspects of Modern Cryptography


Answer 1 cont

Answer #1 (cont.)

Inductive step:

Assume that xk(p–1)+1 mod p = x mod p.

Prove that x(k+1)(p–1)+1 mod p = x mod p.

Practical Aspects of Modern Cryptography


Answer 1 cont1

Answer #1 (cont.)

x(k+1)(p–1)+1 mod p

= xk(p–1)+(p-1)+1 mod p

= xk(p–1)+1+(p-1) mod p

= xk(p–1)+1x(p-1) mod p

= xx(p-1) mod p (by inductive hypothesis)

= xp mod p

= xp mod p (by Fermat’s Little Theorem)

Practical Aspects of Modern Cryptography


Problem 2

Problem #2

Show that for distinct primes p and q,

x mod p = y mod p

x mod q = y mod q

together imply that

x mod pq = y mod pq.

Practical Aspects of Modern Cryptography


Answer 2

Answer #2

x mod p = y mod p

 (x mod p) – (y mod p) = 0

 (x – y) mod p = 0 (by first assignment)

 (x – y) is a multiple ofp.

Similarly x mod q = y mod q

 (x – y) is a multiple ofq.

Practical Aspects of Modern Cryptography


Answer 2 cont

Answer #2 (cont.)

Therefore, (x – y) is a multiple ofpq

 (x – y) mod pq = 0

 (x mod pq) – (y mod pq) = 0

x mod pq = y mod pq.

Practical Aspects of Modern Cryptography


Problem 3

Problem #3

Put everything together to prove that

xK(p–1)(q-1)+1 mod pq = x mod pq

For K ≥ 0 and distinct primes p and q.

Practical Aspects of Modern Cryptography


Answer 3

Answer #3

Let k1=K(q–1) and k2=K(p–1).

xK(p–1)(q-1)+1 mod p = xk1(p–1)+1 mod p = x mod p

and

xK(p–1)(q-1)+1 mod q = xk1(q–1)+1 mod q = x mod q

By Problem #1, and then by Problem #2

xK(p–1)(q-1)+1 mod pq = x mod pq.

Practical Aspects of Modern Cryptography


Problem 4

Problem #4

E(x) = x43 mod 143

Find the inverse function

D(x) = xd mod 143.

Practical Aspects of Modern Cryptography


Answer 4

Answer #4

143 = 1113

We need to find d such that

43d mod (11–1)(13–1) = 1.

Use the Extended Euclidean Algorithm to find a solution to find x and y such that

120x + 43y = 1.

Practical Aspects of Modern Cryptography


Extended euclidean algorithm

Extended Euclidean Algorithm

Given A,B > 0, set x1=1, x2=0, y1=0, y2=1, a1=A, b1=B, i=1.

Repeat while bi>0: {i = i + 1;

qi = ai-1 div bi-1; bi = ai-1-qibi-1; ai = bi-1;

xi+1=xi-1-qixi; yi+1=yi-1-qiyi}.

For alli: Axi + Byi = ai. Finalai = gcd(A,B).

Practical Aspects of Modern Cryptography


Answer 4 cont

Answer #4 (cont.)

Practical Aspects of Modern Cryptography


Answer 4 cont1

Answer #4 (cont.)

Practical Aspects of Modern Cryptography


Answer 4 cont2

Answer #4 (cont.)

Practical Aspects of Modern Cryptography


Answer 4 cont3

Answer #4 (cont.)

Practical Aspects of Modern Cryptography


Answer 4 cont4

Answer #4 (cont.)

Practical Aspects of Modern Cryptography


Answer 4 cont5

Answer #4 (cont.)

Practical Aspects of Modern Cryptography


Answer 4 cont6

Answer #4 (cont.)

Practical Aspects of Modern Cryptography


Problem 5

Problem #5

Digital Signature Algorithm

Public parameters: q = 11, p = 67, g = 9, y = 62

Private secret: x = 4

Message to be signed: M = 8

Selected random parameter: k = 2

Practical Aspects of Modern Cryptography


The digital signature algorithm

The Digital Signature Algorithm

To sign a 160-bit message M,

  • Generate a random integer k with 0 < k < q,

  • Compute r = (gk mod p) mod q,

  • Compute s = ((M+xr)/k) mod q.

    The pair (r,s) is the signature on M.

Practical Aspects of Modern Cryptography


Answer 5

Answer #5

  • r = (gk mod p) mod q

    = (92 mod 67) mod 11

    = (81 mod 67) mod 11 = 14 mod 11 = 3

  • s = ((M+xr)/k) mod q

    = ((8+43)/2) mod 11

    = (20/2) mod 11 = 10 mod 11 = 10

    The pair (3,10) is the signature on 8.

Practical Aspects of Modern Cryptography


The digital signature algorithm1

The Digital Signature Algorithm

A signature (r,s) on M is verified as follows:

  • Compute w = 1/s mod q,

  • Compute a = wM mod q,

  • Compute b = wr mod q,

  • Compute v = (gayb mod p) mod q.

    Accept the signature only if v = r.

Practical Aspects of Modern Cryptography


Answer 5 cont

Answer #5 (cont.)

  • w = 1/s mod q = 1/10 mod 11 = 10

  • a = wM mod q = 108 mod 11 = 3

  • b = wr mod q = 103 mod 11 = 8

  • v = (93628 mod 67) mod 11

    = (5915 mod 67) mod 11

    = 14 mod 11 = 3

    v = 3 andr = 3 so the signature is validated.

Practical Aspects of Modern Cryptography


  • Login