Number Theory CSS441: Security and Cryptography Sirindhorn - - PowerPoint PPT Presentation

number theory
SMART_READER_LITE
LIVE PREVIEW

Number Theory CSS441: Security and Cryptography Sirindhorn - - PowerPoint PPT Presentation

CSS441 Number Theory Primes Modular Arithmetic Number Theory CSS441: Security and Cryptography Sirindhorn International Institute of Technology Thammasat University Prepared by Steven Gordon on 20 December 2015 css441y15s2l06,


slide-1
SLIDE 1

CSS441 Number Theory Primes Modular Arithmetic

1/15

Number Theory

CSS441: Security and Cryptography

Sirindhorn International Institute of Technology Thammasat University

Prepared by Steven Gordon on 20 December 2015 css441y15s2l06, Steve/Courses/2015/s2/css441/lectures/number-theory.tex, r4295

slide-2
SLIDE 2

CSS441 Number Theory Primes Modular Arithmetic

2/15

Contents

Divisibility and Prime Numbers Modular Arithmetic

slide-3
SLIDE 3

CSS441 Number Theory Primes Modular Arithmetic

3/15

Divisibility

◮ b divides a if a = mb for some m, where a, b and m are

integers

◮ b|a ◮ b is a divisor of a

◮ gcd(a, b): greatest common divisor of a and b

◮ Euclidean algorithm can find gcd

◮ Two integers, a and b, are relatively prime if

gcd(a, b) = 1

slide-4
SLIDE 4

CSS441 Number Theory Primes Modular Arithmetic

4/15

Prime Numbers

◮ An integer p > 1 is a prime number if and only if its

  • nly divisors are ±1 and ±p

◮ Any integer a > 1 can be factored as:

a = pa1

2 × pa2 2 × · · · × pat t

where p1 < p2 < . . . < pt are prime numbers and where each ai is a positive integer

slide-5
SLIDE 5

CSS441 Number Theory Primes Modular Arithmetic

5/15

Primes Under 2000

slide-6
SLIDE 6

CSS441 Number Theory Primes Modular Arithmetic

6/15

Contents

Divisibility and Prime Numbers Modular Arithmetic

slide-7
SLIDE 7

CSS441 Number Theory Primes Modular Arithmetic

7/15

Modular Arithmetic

◮ If a is an integer and n is a positive integer, we define

a mod n to be the remainder when a is divided by n

◮ n is called the modulus ◮ Two integers a and b are congruent modulo n if

(a mod n) = (b mod n), which is written as a ≡ b (mod n)

(mod n) operator maps all integers into the set of integers Zn = {0, 1, . . . , (n − 1)}

◮ Modular arithmetic performs arithmetic operations

within confines of set Zn

slide-8
SLIDE 8

CSS441 Number Theory Primes Modular Arithmetic

8/15

Properties of Modular Arithmetic

◮ Rules of ordinary arithmetic involving addition,

subtraction, and multiplication also apply in modular arithmetic [(a mod n) + (b mod n)] mod n = (a + b) mod n [(a mod n) − (b mod n)] mod n = (a − b) mod n [(a mod n) × (b mod n)] mod n = (a × b) mod n

slide-9
SLIDE 9

CSS441 Number Theory Primes Modular Arithmetic

9/15

Division in Modular Arithmetic

◮ a is additive inverse of b if a + b ≡ 0 (mod n)

◮ All integers have an additive inverse

◮ a is multiplicative inverse of b if a × b ≡ 1 (mod n)

◮ Not all integers have a multiplicative inverse ◮ a has a multiplicative inverse in (mod n) if a is

relatively prime to n

◮ Division: a ÷ b ≡ a × MultInverse(b) (mod n)

slide-10
SLIDE 10

CSS441 Number Theory Primes Modular Arithmetic

10/15

Fermat’s Theorem

◮ Fermat’s Theorem (1): if p is prime and a is a positive

integer not divisible by p, then ap−1 ≡ 1 (mod p)

◮ Fermat’s Theorem (2): if p is prime and a is a positive

integer, then ap ≡ a (mod p)

slide-11
SLIDE 11

CSS441 Number Theory Primes Modular Arithmetic

11/15

Euler’s Theorem

◮ Euler’s Totient Function, φ(n): the number of positive

integers less than n and relatively prime to n

◮ φ(1) = 1 ◮ For prime p, φ(p) = p − 1 ◮ For primes p and q, and n = pq,

φ(n) = (p − 1) × (q − 1)

◮ Euler’s Theorem (1): For every a and n that are

relatively prime: aφ(n) ≡ 1 (mod n)

◮ Euler’s Theorem (2): For positive integers a and n:

aφ(n)+1 ≡ a (mod n)

slide-12
SLIDE 12

CSS441 Number Theory Primes Modular Arithmetic

12/15

Logarithms in Modular Arithmetic

◮ Exponentiation (mod n): repeated multiplication ◮ Logarithms in ordinary arithmetic:

b = ai i = loga(b)

◮ Logarithms in modular arithmetic (discrete logarithm):

b = ai (mod p) i = dloga,p(b)

◮ A unique exponent i can be found if a is a primitive

root of prime p

◮ If a is a primitive root of p then a, a2, a3, . . . , ap−1 are

distinct (modp)

◮ Only integers with primitive roots: 2, 4, pα, 2pα where

p is any odd prime and alpha is positive integer

slide-13
SLIDE 13

CSS441 Number Theory Primes Modular Arithmetic

13/15

Powers of Integers, Modulo 19

Credit: Table 8.3 in Stallings, Cryptography and Network Security, 5th Ed., Pearson 2011

slide-14
SLIDE 14

CSS441 Number Theory Primes Modular Arithmetic

14/15

Discrete Logarithms, Modulo 19

Credit: Table 8.4 in Stallings, Cryptography and Network Security, 5th Ed., Pearson 2011

slide-15
SLIDE 15

CSS441 Number Theory Primes Modular Arithmetic

15/15

Complexity

Certain problems are computationally hard . . .

Integer Factorisation

◮ If p and q are unknown primes, given n = pq, find p

and q

◮ Largest RSA number factored into two primes is 768

bits (232 decimal digits)

Euler’s Totient

◮ Given composite n, find φ(n) ◮ Harder than integer factorisation

Discrete Logarithms

◮ Given b, a and p, find i such that i = dloga,p(b) ◮ Comparable to integer factorisation