• No results found

Lect 7 RSA support (1)

N/A
N/A
Protected

Academic year: 2020

Share "Lect 7 RSA support (1)"

Copied!
31
0
0

Loading.... (view fulltext now)

Full text

(1)

Cryptography and Security

Cryptography and Security

Mechanisms

Mechanisms

Nazar Abbas Saqib

[email protected]

(2)

2

Agenda

Agenda

Agenda

Agenda

Agenda

Agenda

Agenda

Agenda

Prime Numbers

(3)

An integer p > 1 is a prime number if its only divisors are ±1 and ±p

Primes Under 2000

(4)
(5)
(6)
(7)
(8)

Primality Testing

(9)

Primality Testing

(10)

Primality Testing

(11)

Fundamental Theorem of Arithmetic

Fundamental Theorem of Arithmetic

Every integer

n

≥ 2 has a factorization as a product of

prime powers:

Where the

p

i

are distinct primes, and the

e

i

are positive

integers. Furthermore, the factorization is unique up to

the rearrangement of factors.

,

2 1

2

1

k

e

k

e

e

p

p

p

(12)

Factorization Prime Number

Factorization Prime Number

Trial division method

Trial division method

(13)

Factorization Prime Number

Factorization Prime Number

Trial division method

Trial division method

(14)

Determining GCD

Determining GCD

GCD of any positive integers can be easily determined if

they are written as a product of prime powers:

(15)

15

RSA Factoring Challenge

RSA Factoring Challenge

Numbers are designated “RSA-XXXX”, where XXXX is the number’s length in bits

Challenge Number Prize ($US) Status

RSA-576 (174 Digits) $10,000 Factored (Dec 2003) RSA-640 (193 Digits) $20,000 Factored (Nov 2005) RSA-704 (212 Digits) $30,000 Not Factored

RSA-768 (232 Digits) $50,000 Not Factored RSA-896 (270 Digits) $75,000 Not Factored RSA-1024 (309 Digits) $100,000 Not Factored RSA-1536 (463 Digits) $150,000 Not Factored RSA-2048 (617 Digits) $200,000 Not Factored

RSA-704

Decimal Digits: 212

(16)
(17)

17

Relatively Prime Numbers

Relatively Prime Numbers

Two integers are relatively prime if there only common

positive integer factor is 1

(18)

Fermat’s Little Theorem (FLT)

Fermat’s Little theorem:

If p is prime and a is a positive integer not divisible by p, then

ap-11 mod p

a=7, p=19

72 = 49 11 (mod 19)

74 = 121 7 (mod 19)

78 = 49 11 (mod 19)

716 = 121 7 (mod 19)

ap-1 = 718 = 716x72 7x111 (mod 19

)

719 (mod 19) ?

720 (mod 19) ?

721 (mod 19) ?

(19)

Fermat’s Little Theorem

• Alternative Form

If p is prime and a is a positive integer, then

a

p

a mod

p

Example 1:

a=3, p=5 ap=35 = 243 3 (mod 5)= a (mod p)

Example 2:

a=10, p=5 ap=105 = 100000 10 (mod 5) 0 (mod 5) a

(mod p)

(20)

Fermat’s Little Theorem-Application

8-1 mod 17=817-2 mod 17=815 mod 17=15 mod 17

(21)

Euler’s Phi-Function

Definition: Euler’s phi-function φ(n) is defined to be the

number of positive integers less than n (including 1) that are relatively prime to n

Example 1: Because 37 is prime, all positive integers from

1 through 36 are relatively prime. Thus Ф(37)=36

Example 2: Ф(35)=24 ?

To determine Ф(35), we list all of the positive integers less than 35 that are relatively prime to n

(22)

22

Euler’s Phi-Function

For two prime numbers p & q, with p≠q,

n=pq

Ф(n)= Ф(pq)= Ф(p) × Ф(q)= (p -1)×(q-1)

Example: Ф(21)= Ф(3)× Ф(7)=Ф(3-1)× Ф(7-1)=2×6=12

Where the 12 integers are

(23)

23

Euler Theorem

Euler’s theorem states that for every a and n that are relatively prime:

aФ(n) 1 mod n

Example 1: a=3,n=10; Ф(10)=4 aФ(n) = 34 =81 1 (mod 10) = 1

(mod n)

Example 2: a=2,n=11; Ф(11)=10 aФ(n)= 210=1024 1 (mod 11) = 1

(mod n)

An alternative form of the theorem is:

aФ(n) +1 a mod n

(24)

24

(25)

Modular Exponentiation

M

15

How many multiplications are needed??

Naïve Answer (requires 14 multiplications):

M

M

2

M

3

M

4

M

5

M

15

Binary Method (requires 6 multiplications):

(26)

Modular Exponentiation: Binary Method

Let k be the number of bits of e, i.e.,

Input: M, e, n.

Output: C := Me mod n

1. If ek-1 = 1 then C := M else C := 1; 2. For i = k-2 downto 0

3. C := C2 mod n

4. If ei = 1 then C := C x M mod n

3. Return C;

(

)

(27)

Modular Exponentiation: Binary Method

Example: e = 250 = (11111010), thus k = 8

Initially, C = M since e

k-1

= e

7

= 1

i ei Step 2a Step 2b

7 1 M M

6 1 (M)2 = M2 M2

M = M3

5 1 (M3)2 = M6 M6

M = M7

4 1 (M7)2 = M14 M14

M = M15

3 1 (M15)2 = M30 M30

M = M31

2 0 (M31)2 = M62 M62

1 1 (M62)2 = M124 M124

M = M125

(28)

Discrete Logarithmic Problem

Many tools based on discrete logarithm problem

ax = y modulo n

given x „easy“ to find y given y „hard“ to find x

Example?

102=100

Log10100 = 2

Guess the values of ‘x’ when

5x=7 mod 19

(29)
(30)
(31)

Chinese Remainder Theorem

Chinese Remainder Theorem

1

mod

i i i

M

M

m

m

=

1 1 1 1 1

mod

M

M

m

m

− −

=

1 1 1

3 5 7

mod 3

3

M

− −

× ×

=

Solution: Four steps

1 1

1

35

2 mod 3

M

=

1 1

2

21

1mod 5

M

=

1 1

3

15

1mod 7

References

Related documents