Cryptography and Network Security Number Theory



Similar documents
Cryptography and Network Security Chapter 8

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, Notes on Algebra

Overview of Number Theory Basics. Divisibility

Lecture 13 - Basic Number Theory.

8 Primes and Modular Arithmetic

Computer and Network Security

Primality - Factorization

RSA and Primality Testing

Public Key Cryptography: RSA and Lots of Number Theory

Discrete Mathematics, Chapter 4: Number Theory and Cryptography

= = 3 4, Now assume that P (k) is true for some fixed k 2. This means that

Is n a Prime Number? Manindra Agrawal. March 27, 2006, Delft. IIT Kanpur

Integer Factorization using the Quadratic Sieve

Principles of Public Key Cryptography. Applications of Public Key Cryptography. Security in Public Key Algorithms

Groups in Cryptography

Primality Testing and Factorization Methods

ABSTRACT ALGEBRA: A STUDY GUIDE FOR BEGINNERS

Chapter. Number Theory and Cryptography. Contents

Study of algorithms for factoring integers and computing discrete logarithms

Lecture Note 5 PUBLIC-KEY CRYPTOGRAPHY. Sourav Mukhopadhyay

Revised Version of Chapter 23. We learned long ago how to solve linear congruences. ax c (mod m)

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

Public Key Cryptography and RSA. Review: Number Theory Basics

Prime Numbers. Difficulties in Factoring a Number: from the Perspective of Computation. Computation Theory. Turing Machine 電 腦 安 全

Applications of Fermat s Little Theorem and Congruences

CHAPTER SIX IRREDUCIBILITY AND FACTORIZATION 1. BASIC DIVISIBILITY THEORY

Math 453: Elementary Number Theory Definitions and Theorems

Notes on Network Security Prof. Hemant K. Soni

Homework until Test #2

FACTORING. n = fall in the arithmetic sequence

Today s Topics. Primes & Greatest Common Divisors

Number Theory. Proof. Suppose otherwise. Then there would be a finite number n of primes, which we may

Elements of Applied Cryptography Public key encryption

Lecture 13: Factoring Integers

Factoring Algorithms

SUM OF TWO SQUARES JAHNAVI BHASKAR

An Overview of Integer Factoring Algorithms. The Problem

Faster deterministic integer factorisation

Public-key cryptography RSA

The cyclotomic polynomials

Factoring & Primality

Factoring Algorithms

Factoring integers, Producing primes and the RSA cryptosystem Harish-Chandra Research Institute

Number Theory Hungarian Style. Cameron Byerley s interpretation of Csaba Szabó s lectures

Copy in your notebook: Add an example of each term with the symbols used in algebra 2 if there are any.

Quotient Rings and Field Extensions

3. Computational Complexity.

Number Theory: A Mathemythical Approach. Student Resources. Printed Version

Breaking The Code. Ryan Lowe. Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and

Integer factoring and modular square roots

Overview of Public-Key Cryptography

8 Divisibility and prime numbers

MATH 537 (Number Theory) FALL 2016 TENTATIVE SYLLABUS

Chapter 3. if 2 a i then location: = i. Page 40


2.1 Complexity Classes

CS 103X: Discrete Structures Homework Assignment 3 Solutions

Cryptography and Network Security

On Factoring Integers and Evaluating Discrete Logarithms

How To Know If A Message Is From A Person Or A Machine

A Course on Number Theory. Peter J. Cameron

An Introductory Course in Elementary Number Theory. Wissam Raji

CIS 5371 Cryptography. 8. Encryption --

Introduction to Modern Algebra

k, then n = p2α 1 1 pα k

15 Prime and Composite Numbers

minimal polyonomial Example

SIMS 255 Foundations of Software Design. Complexity and NP-completeness

CS549: Cryptography and Network Security

Factorization Algorithms for Polynomials over Finite Fields

SYSTEMS OF PYTHAGOREAN TRIPLES. Acknowledgements. I would like to thank Professor Laura Schueller for advising and guiding me

Public Key (asymmetric) Cryptography

ECE 842 Report Implementation of Elliptic Curve Cryptography

6.1 The Greatest Common Factor; Factoring by Grouping

CoNP and Function Problems

Two Integer Factorization Methods

Some facts about polynomials modulo m (Full proof of the Fingerprinting Theorem)

GREATEST COMMON DIVISOR

RSA Attacks. By Abdulaziz Alrasheed and Fatima

Modern Factoring Algorithms

Computing exponents modulo a number: Repeated squaring

Arkansas Tech University MATH 4033: Elementary Modern Algebra Dr. Marcel B. Finan

Cryptography and Network Security

QUANTUM COMPUTERS AND CRYPTOGRAPHY. Mark Zhandry Stanford University

Lectures on Number Theory. Lars-Åke Lindahl

Chapter 1. Computation theory

Lecture 6: Finite Fields (PART 3) PART 3: Polynomial Arithmetic. Theoretical Underpinnings of Modern Cryptography

CSCE 465 Computer & Network Security

Factoring Polynomials

Why? A central concept in Computer Science. Algorithms are ubiquitous.

Communications security

MATH 168: FINAL PROJECT Troels Eriksen. 1 Introduction

Module MA3411: Abstract Algebra Galois Theory Appendix Michaelmas Term 2013

How To Prove The Dirichlet Unit Theorem

Cryptography and Network Security Chapter 9

Arithmetic algorithms for cryptology 5 October 2015, Paris. Sieves. Razvan Barbulescu CNRS and IMJ-PRG. R. Barbulescu Sieves 0 / 28

Factoring by Quantum Computers

Introduction to Finite Fields (cont.)

LUC: A New Public Key System

Transcription:

Cryptography and Network Security Number Theory Xiang-Yang Li

Introduction to Number Theory Divisors b a if a=mb for an integer m b a and c b then c a b g and b h then b (mg+nh) for any int. m,n Prime number P has only positive divisors 1 and p Relatively prime numbers No common divisors for p and q except 1

GCD Greatest common divisor gcd(a,b) The largest number that divides both a and b Euclid's algorithm Find the GCD of two numbers a and b, a<b Use fact if a and b have divisor d so does a- b, a-2b

Cont. GCD (a,b) is given by: let g 0 =b g 1 =a g i+1 = g i-1 mod g i when g i =0 then gcd(a,b) = g i-1 The algorithm terminates in O(log b) rounds Why?

Properties For any two integers a and b Exist integers m and n: gcd(a,b) =ma+bn Example: a=2, b=3; we choose m=-1, n=1 so 2+3=1 a=6, b=11; we choose m=2, n=-1 so 2*6-11=1 Simple proof? Integer a can be factored as a=p 1 a 1 p 2 a 2 p 3 a 3. p n a n where p i is prime number

Modular Arithmetic Congruence a b mod n says when divided by n that a and b have the same remainder It defines a relationship between all integers a a a b then b a a b, b c then a c

Cont. addition (a+b) mod n (a mod n) + (b mod n) subtraction a-b mod n a+(-b) mod n multiplication a*b mod n derived from repeated addition Possible: a*b 0 where neither a, b 0 mod n

Cont. Division a/b mod n multiplied by inverse of b: a/b = a*b -1 mod n b -1* b 1 mod n 3-1 7 mod 10 because 3*7 1 mod 10 Inverse does not always exist! Only when gcd(b,n)=1

Addition and Multiplication Integers modulo n with addition and multiplication form a commutative ring with the laws of Associativity (a+b)+c a+(b+c) mod n Commutativity a+b b+a mod n Distributivity (a+b)*c (a*c)+(b*c) mod n

Galois Field If n is constrained to be a prime number p then this forms a Galois field modulo p denoted GF(p) and all the normal laws associated with integer arithmetic work Exponentiation b = a e mod p Discrete Logarithms find x where a x = b mod p

Inverses and Euclid's Extended GCD Routine If (a,n)=1 then the inverse always exists Can extend Euclid's algorithm to find inverse by keeping track of g i = u i.n + v i.a Extended Euclid's (or binary GCD) algorithm to find inverse of a number a mod n (where (a,n)=1) is:

Inverse Inverse(a,n) is given by: X=(x1,x2,x3)=(1,0,n); Y=(y1,y2,y3)=(0,1,a) If y3=0 return x3=gcd(a,n); no inverse If y3=1 return y3=gcd(a,n); y2=a -1 mod n Q=[x3/y3] T=X-Q*Y X=Y; Y=T Goto 2 nd step

Proof Assume we compute gcd(x 0,y 0 ) Let X i =(x i,y i ); 0 x i -q i+1 y i < y i Then X i =M i X i-1, where M i =(0,1; 1,-q i ) Assume the gcd algorithm terminates in n steps We have M n M n-1 M 1 X 0 =(gcd(x 0,y 0 ), 0) T Assume M n M n-1 M 1 =( ) Then ax 0 +by 0 =gcd(x 0,y 0 ) a c b d The above algorithm is to keep track of a,b,c,d, and x i,y i values.

Euler Totient Function If consider arithmetic modulo n, then a reduced set of residues is a subset of the complete set of residues modulo n which are relatively prime to n eg for n=10, the complete set of residues is {0,1,2,3,4,5,6,7,8,9} the reduced set of residues is {1,3,7,9} The number of elements in the reduced set of residues is called the Euler Totient function f(n)

Euler's Theorem Let gcd(a,n)=1 then a φ(n) mod n = 1 Proof: consider all reduced residues x i Then ax i also form reduced residues set Using Π ax i = Π x i mod n and Π x i has inverse Compute φ(n) If factoring of n is known φ(n)=n Π(1-1/p i ) where p i is its prime factor Otherwise It is expensive!

Fermat's Theorem Let p be a prime and gcd(a,p)=1 then a p-1 mod p = 1 Proof: similar to the proof of Euler s theorem But consider all integers in Z p Generally, for any prime number p a p mod p = a

Chinese Remainder Theorem Let m 1,m 2,.m k be pair-wise relative prime numbers Assume integer A= a i mod m i Then A= Σ a i C i mod M Where M=Π m i ; M i =M/ m i C i = M i * (M i -1 mod m i )

Primality Testing To check if exists integer a such that a p Primary school method Two slow! Check n 0.5 numbers At least around (n/ln n) 0.5 numbers need be checked Any improvement?

Simple Fact Equation x 2 1 mod p has only solutions1,-1 If p is prime number Simple proof: (x+1)(x-1) 0 mod p So if we find another solution, then p can not be prime number! Miller and Rabin 1975,1980 Randomly chosen integer a If a 2 1 mod p then p is not prime number Integer a is called the witness Otherwise p maybe, or maybe not a prime number

Witness Algorithm Witness(a,n) Let b k b k-1 b 1 b 0 be the binary code of n-1 Let d=1 For i=k downto 0 x=d; d=d*d mod n If d=1 and x 1, and x n-1 return TRUE If b i =1 then d=d*a mod n Endfor If d 1 then return TRUE Return FALSE

Facts Analysis the result of witness If returns TRUE, then n is not prime number Find other solutions for x 2 1 mod n Otherwise, n maybe prime number Given odd n and random a Witness fails with probability less than 0.5 Run witness algorithm s times If one time, it is TRUE Then n is not prime number Otherwise, Pr(n is prime)>1-2 -s

Randomized Methods Las Vegas Method Always produces correct results Runs in expected polynomial time Monte Carlo Method Runs in polynomial time May produce incorrect results with bounded probability No-Biased Monte Carlo Method Answer yes is always correct, but the answer no may be wrong Yes-biased Monte Carlo Method Answer no is always correct, but the answer yes may be wrong

Witness Algorithm Witness Algorithm is based on Monte Carlo Method It actually test compositeness, not primality When it reports yes, the number is always composite When it reports no, input may be composite, prime Probability Result Pr(input=composite ans=composite)= 1 Pr(ans=no input=composite)<1/2 Pr(input=composite ans=no) 1/4

Time Complexity Each round of witness cost O(log n) Unit: integer multiplication and modular arithmetic So the primality testing cost O(slog n) The confidence is 1-2 -s if report prime The confidence is 1 if report non-prime

Primitive Root Order of integer The order of a modulo n is the smallest positive k such that a k 1 mod n Primitive Root Integer a is a primitive root of n if the order of a modulo n is φ(n) Not all integers have primitive root Example n=pq for primes p and q Prime p has φ(p-1) primitive roots

Discrete Logarithms Y g x mod p Compute x Time complexity O(e (ln p)1/3 (ln ln p) 2/3 )

Quadratic Residue Quadratic Residue Integer b is a quadratic residue of integer n if and only if x 2 b mod n has a solution for x Otherwise b is called quadratic nonresidue Given odd prime p, b is quadratic residue, iff b (p-1)/2 1 mod n b is quadratic nonresidue, iff b (p-1)/2-1 mod n

Complexity Theory The input length of a problem is the number n of symbols used to characterize it Function f(n) is order O(g(n)) if f(n)<=c* g(n), for all n>=n 0, for some c Polynomial time algorithm (P) solves any instance of a particular problem with input length n in time O(p(n)), where p is a polynomial

Cont. Non-deterministic polynomial time algorithm (NP) - is one for which any guess at the solution of an instance of the problem may be checked for validity in polynomial time. NP-complete problems - are a subclass of NP problems for which it is known that if any such problem has a polynomial time solution, then all NP problems have polynomial solutions. Co-NP: the complements of NP problems.