Todays Agenda Wrap up of Number Theory (Sec. 3.7) Fermats Little - - PowerPoint PPT Presentation

today s agenda
SMART_READER_LITE
LIVE PREVIEW

Todays Agenda Wrap up of Number Theory (Sec. 3.7) Fermats Little - - PowerPoint PPT Presentation

Todays Agenda Wrap up of Number Theory (Sec. 3.7) Fermats Little Theorem Public Key Cryptography (RSA) Strings and Languages (Chap. 12) Based on Rosen and slides by K. Busch 1 Fermats little theorem: For any prime and


slide-1
SLIDE 1

Today’s Agenda

  • Wrap up of Number Theory (Sec. 3.7)
  • Fermat’s Little Theorem
  • Public Key Cryptography (RSA)
  • Strings and Languages (Chap. 12)

1 Based on Rosen and slides by K. Busch

slide-2
SLIDE 2

2

Fermat’s little theorem:

For any prime and integer not divisible by ( ):

p

a p

) (mod 1

1

p a p 

Example:

2  a 5  p

) 5 (mod 1 16 24  

1 ) , gcd(  p a

Pierre de Fermat (1601-1665)

a

(We will use FLT in the RSA cryptosystem)

slide-3
SLIDE 3

3

Public Key Cryptography (RSA cryptosystem) “MEET YOU IN THE PARK” “9383772909383637467”

n x x f

e mod

) (  n y y f

d mod

) (

1

encryption decryption

q p n  

Large primes

e n,

are public keys

q p,

are private keys for finding d for any e

1 )) 1 )( 1 ( , gcd(    q p e

(with the condition that )

slide-4
SLIDE 4

Key Idea: Everyone knows n (= pq) and e, but to find d to decrypt, need to know what p and q are.

4

Practically impossible to factor n into p and q if p and q are chosen to be primes of 200 digits or more.

slide-5
SLIDE 5

5

Message to encrypt: “STOP” Encryption example:

43  p 59  q 13  e 2537    q p n

1 ) 58 42 , 13 gcd( )) 1 )( 1 ( , gcd(      q p e Translate to equivalent numbers

“18 19 14 15” “1819 1415”

Group into blocks of two numbers

slide-6
SLIDE 6

6

“1819 1415” “2081 2182”

2537 mod mod ) (

13

x n x x f

e

 

2081 2537 mod 1819 ) 1819 (

13

  f 2182 2537 mod 1415 ) 1415 (

13

  f

Apply encryption function to each block

Encrypted message:

Use fast modular exponentiation algorithm:

slide-7
SLIDE 7

7

Message decryption

M C

:an original block of the message :respective encrypted block “1819 1415” “2081 2182” We want to recover by knowing

M e q p C , , , ) (modn M C

e

encrypt

slide-8
SLIDE 8

8

Let = inverse of modulo

d

e

) 1 )( 1 (   q p

)) 1 )( 1 (mod( 1    q p de

) 1 )( 1 ( 1     q p k de

Inverse exists because

1 )) 1 )( 1 ( , gcd(    q p e

by definition of congruent

) 1 )( 1 mod( 1 i.e., ) 1 )( 1 ( 1 )) 1 )( 1 ( , gcd(           q p se q p t se q p e

s d 

Does inverse d always exist?

slide-9
SLIDE 9

9

) (modn M C

e

 

) (modn M C

d e d 

) (mod

) 1 )( 1 ( 1

n M M C

q p k de d   

 

) 1 )( 1 ( 1     q p k de

Encryption Decryption

slide-10
SLIDE 10

10

In real-world case,

1 ) , gcd(  p M

(because is a large prime and is small)

p M

1 ) , gcd(  p M

By Fermat’s little theorem

) (mod 1

1

p M p 

Remember me?

slide-11
SLIDE 11

11

) (mod 1

1

p M p 

 

) (mod 1 1

) 1 ( ) 1 ( 1

p M

q k q k p

 

  

 

) (mod 1

) 1 ( 1

p M M M

q k p

  

 

) (mod p M M 

) (mod

) 1 )( 1 ( 1

p M M

q p k

  

Multiply under mod

slide-12
SLIDE 12

12

) (mod

) 1 )( 1 ( 1

p M M

q p k

  

By symmetry (by replacing with ):

) (mod

) 1 )( 1 ( 1

q M M

q p k

  

q p

We showed: By Exercise 23 (Sec. 3.7):

) (mod ) (mod

) 1 )( 1 ( 1

n M pq M M

q p k

 

  

slide-13
SLIDE 13

13

) (mod

) 1 )( 1 ( 1

n M C

q p k d   

) (mod

) 1 )( 1 ( 1

n M M

q p k

  

We showed:

) (modn M Cd 

In other words, the original message:

n C M

d mod

slide-14
SLIDE 14

14

Decryption example: “2081 2182”

43  p 59  q 13  e 2537    q p n

1 ) 58 42 , 13 gcd( )) 1 )( 1 ( , gcd(      q p e

937

n C M

d mod

1819 2537 mod 2081937  1415 2537 mod 2182937 

“1819 1415” “18 19 14 15” = “STOP” Compute = inverse of modulo =

e

58 42

d