Applied Cryptography and Computer Security CSE 664 Spring 2017

Similar documents
Remainders. We learned how to multiply and divide in elementary

3 The fundamentals: Algorithms, the integers, and matrices

4 Number Theory and Cryptography

Basic elements of number theory

Basic elements of number theory

Number Theory and Group Theoryfor Public-Key Cryptography

Intermediate Math Circles February 26, 2014 Diophantine Equations I

cse 311: foundations of computing Spring 2015 Lecture 12: Primes, GCD, applications

Exercises Exercises. 2. Determine whether each of these integers is prime. a) 21. b) 29. c) 71. d) 97. e) 111. f) 143. a) 19. b) 27. c) 93.

5: The Integers (An introduction to Number Theory)

Proofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook)

ECEN 5022 Cryptography

MATH 501 Discrete Mathematics. Lecture 6: Number theory. German University Cairo, Department of Media Engineering and Technology.

Discrete Mathematics GCD, LCM, RSA Algorithm

MATH 145 Algebra, Solutions to Assignment 4

cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications

LECTURE NOTES IN CRYPTOGRAPHY

CS March 17, 2009

a the relation arb is defined if and only if = 2 k, k

4 Powers of an Element; Cyclic Groups

Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory.

Intermediate Math Circles February 29, 2012 Linear Diophantine Equations I

CMPUT 403: Number Theory

Integers and Division

COT 3100 Applications of Discrete Structures Dr. Michael P. Frank

Numbers. Çetin Kaya Koç Winter / 18

An Algorithm for Prime Factorization

2 Elementary number theory

Applied Cryptography and Computer Security CSE 664 Spring 2018

Number Theory Proof Portfolio

Topics in Cryptography. Lecture 5: Basic Number Theory

Math.3336: Discrete Mathematics. Primes and Greatest Common Divisors

COMP239: Mathematics for Computer Science II. Prof. Chadi Assi EV7.635

CSE 311: Foundations of Computing. Lecture 12: Two s Complement, Primes, GCD

Introduction to Cryptography. Lecture 6

Senior Math Circles Cryptography and Number Theory Week 2

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya

Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Spring 2006

7.2 Applications of Euler s and Fermat s Theorem.

The Euclidean Algorithm and Multiplicative Inverses

Algorithmic number theory. Questions/Complaints About Homework? The division algorithm. Division

Number Theory. Zachary Friggstad. Programming Club Meeting

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations

Some Facts from Number Theory

Public Key Encryption

CS483 Design and Analysis of Algorithms

Chapter 8 Public-key Cryptography and Digital Signatures

Introduction to Information Security

The set of integers will be denoted by Z = {, -3, -2, -1, 0, 1, 2, 3, 4, }

For your quiz in recitation this week, refer to these exercise generators:

Cryptosystem. Traditional Cryptosystems: The two parties agree on a secret (one to one) function f. To send a message M, thesendersendsthemessage

CSE 311 Lecture 13: Primes and GCD. Emina Torlak and Kevin Zatloukal

Lecture 3.1: Public Key Cryptography I

Number Theory & Modern Cryptography

CS 5319 Advanced Discrete Structure. Lecture 9: Introduction to Number Theory II

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

Outline. Some Review: Divisors. Common Divisors. Primes and Factors. b divides a (or b is a divisor of a) if a = mb for some m

Outline. AIT 682: Network and Systems Security. GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation Discrete Logarithms

Introduction to Cryptography CS 355 Lecture 3

cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska

Ch 4.2 Divisibility Properties

1 Overview and revision

Discrete Structures Lecture Primes and Greatest Common Divisor

Addition. Ch1 - Algorithms with numbers. Multiplication. al-khwārizmī. al-khwārizmī. Division 53+35=88. Cost? (n number of bits) 13x11=143. Cost?

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes.

[Part 2] Asymmetric-Key Encipherment. Chapter 9. Mathematics of Cryptography. Objectives. Contents. Objectives

CPSC 467b: Cryptography and Computer Security

Chapter 5. Number Theory. 5.1 Base b representations

CSC 474 Network Security. Outline. GCD and Euclid s Algorithm. GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation Discrete Logarithms

4. Number Theory (Part 2)

An Introduction to Mathematical Thinking: Algebra and Number Systems. William J. Gilbert and Scott A. Vanstone, Prentice Hall, 2005

8. Given a rational number r, prove that there exist coprime integers p and q, with q 0, so that r = p q. . For all n N, f n = an b n 2

ECE596C: Handout #11

Elementary Number Theory MARUCO. Summer, 2018

Introduction to Number Theory. The study of the integers

CS250: Discrete Math for Computer Science

#26: Number Theory, Part I: Divisibility

Chuck Garner, Ph.D. May 25, 2009 / Georgia ARML Practice

Number theory lectures

Finite Fields. Mike Reiter

Math 4400 First Midterm Examination September 21, 2012 ANSWER KEY. Please indicate your reasoning and show all work on this exam paper.

Direct Proof MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Direct Proof Fall / 24

Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013

Public Key Cryptography

Signature: (In Ink) UNIVERSITY OF MANITOBA TEST 1 SOLUTIONS COURSE: MATH 2170 DATE & TIME: February 11, 2019, 16:30 17:15

1. Given the public RSA encryption key (e, n) = (5, 35), find the corresponding decryption key (d, n).

Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()

Mathematical Foundations of Public-Key Cryptography

1. Factorization Divisibility in Z.

Math 131 notes. Jason Riedy. 6 October, Linear Diophantine equations : Likely delayed 6

Chapter 5: The Integers

Introduction to Cybersecurity Cryptography (Part 5)

Integer and Polynomial Arithmetic First Steps towards Abstract Algebra. Arjeh M. Cohen Hans Cuypers Hans Sterk

Wednesday, February 21. Today we will begin Course Notes Chapter 5 (Number Theory).

Theory of RSA. Hiroshi Toyoizumi 1. December 8,

NOTES ON SIMPLE NUMBER THEORY

Mathematical Foundations of Cryptography

Basic Algorithms in Number Theory

Number Theory: Applications. Number Theory Applications. Hash Functions II. Hash Functions III. Pseudorandom Numbers

Transcription:

Applied Cryptography and Computer Security Lecture 11: Introduction to Number Theory Department of Computer Science and Engineering University at Buffalo 1

Lecture Outline What we ve covered so far: symmetric encryption hash functions Where we are heading: number theory public-key encryption digital signatures 2

Lecture Outline Introduction to number theory divisibility GCD and Euclidean algorithm prime and composite numbers Chinese remainder theorem Euler φ function Fermat s theorem 3

Divisibility Divisibility given integers a and b, we say that a divides b (denoted by a b) if b = ac for integer c a is called a divisor of b Transitivity theorem we are given integers a, b, and c, all of which > 1 if a b and b c, then a c Linear combination theorem let a, b, c, x, and y be integers > 1 if a b and a c, then a (bx + cy) 4

Divisibility Division algorithm (theorem) let a > 0 and b be two integers then there exist two unique integers q and r such that 0 r < a and b = aq + r Notation the integer q is called the quotient the integer r is called the remainder x is the floor of x (largest integer x) x is the ceiling of x (smallest integer x) then q = b/a and r = b mod a 5

Greatest Common Divisor Greatest common divisor (GCD) suppose we are given integers a and b which are not both 0 their greatest common divisor gcd(a, b) = c is the greatest number that divides both a and b example: gcd(128, 100) = 4 it is clear that gcd(a, b) = gcd(b, a) GCD and multiplication we are given integers a, b, and m > 1 if gcd(a, m) = gcd(b, m) = 1, then gcd(ab, m) = 1 example: gcd(25, 7) = gcd(3, 7) = 1 gcd(75, 7) = 1 6

Greatest Common Divisor GCD and division Theorem 1 we are given integers a and b if g = gcd(a, b), then gcd( a g, g b ) = 1 example: gcd(25, 45) = 5 gcd( 25 5, 45 5 ) = gcd(5, 9) = 1 Theorem 2 if a is a positive integer and b, q, and r are integers with b = aq + r, then gcd(b, a) = gcd(a, r) we can use this theorem to find GCD 7

Euclidean Algorithm Fact: given integers a > 0, b, q, and r such that b = aq + r, gcd(a, b) = gcd(a, r) Euclidean algorithm for finding gcd(a, b) apply the division algorithm iteratively to compute the remainder the last non-zero remainder is the answer while a 0 do r b mod a b a a r return b 8

Euclidean Algorithm Example: compute GCD of 165 and 285 steps of Euclidean algorithm: the answer is gcd(165, 285) = 9

Towards Extended Euclidean Algorithm Theorem: if integers a and b are not both 0, then there are integers x and y so that ax + by = gcd(a, b) we can find x and y using the extended Euclidean algorithm Example: find x and y such that 285x + 165y = gcd(285, 165) = 15 we start with the next to last equation in our example and work backwards 10

Extended Euclidean Algorithm Example (cont.) algorithm steps: thus, we get Also, if gcd(a, b) = 1, then ax + by = 1, i.e., ax mod b = 1 11

Extended Euclidean Algorithm Input: integers a b > 0 Output: g = gcd(a, b) and x and y with ax + by = gcd(a, b) The algorithm itself: x = 1; y = 0; g = a; r = 0; s = 1; t = b while (t > 0) { q = g/t u = x qr; v = y qs; w = g qt x = r; y = s; g = t r = u; s = v; t = w } Algorithm invariants: ax + by = g and ar + bs = t 12

Extended Euclidean Algorithm Complexity of the algorithm (theorem) this result is due to Lamé, 1845 the number of steps (division operations) needed by the Euclidean algorithm is no more than five times of decimal digits in the smaller of the two numbers Corollary the number of bit operations needed by the Euclidean algorithm is O((log 2 a) 3 ), where a is the larger of the two numbers 13

Prime and Composite Numbers Prime numbers a prime number is an integer greater than 1 which is divisible by 1 and itself the first prime numbers are 2, 3, 5, 7, 11, 13, 17, etc. Composite numbers a composite number is an integer greater than 1 which is not prime the composite numbers are 4, 6, 8, 9, 10, 12, 14, etc. Relatively prime numbers integers a and b are relatively prime is gcd(a, b) = 1 relatively prime numbers don t have common divisors other than 1 14

Decomposition of Numbers Fundamental Theorem of Arithmetics: every integer n > 1 can be written as a product of prime numbers and this product is unique if the primes are written in non-decreasing order n = p e 1 1 p e 2 2 p e k k = k i=1 here p 1,..., p k are the primes that divide n and e i 1 is the number of factors of p i dividing n this decomposition is called the standard representation Example: 84 = 2 2 3 7 = 2 2 3 1 7 1 p e i i 15

Using Standard Representation GCD and LCM we are given n = p e 1 1 p e 2 2 p e k k and m = pf 1 are prime numbers and e i, f i 0 1 p f 2 gcd(n, m) = p min(e 1,f 1 ) 1 p min(e 2,f 2 ) 2 p min(e k,f k ) k 2 p f k k, where p i the least common multiple of integers a and b is the smaller positive integer divisible by both a and b lcm(n, m) = p max(e 1,f 1 ) 1 p max(e 2,f 2 ) 2 p max(e k,f k ) k also, gcd(a, b) lcm(a, b) = ab 16

Using Standard Representation Examples: n = 84 = 2 2 3 7 m = 63 = 3 2 7 gcd(84, 63) = lcm(84, 63) = gcd(84, 63) lcm(84, 63) = 17

Distribution of Prime Numbers In cryptography, we ll need to use large primes and would like to know how prime numbers are distributed (Theorem) The number of prime numbers is infinite (Theorem) Gaps between primes for every positive integer n, there are n or more consecutive composite numbers For a positive real number x, let π(x) be the number of prime numbers x 18

Distribution of Prime Numbers The Prime Number Theorem π(x) tends to x/ ln x as x goes to infinity. In symbols, lim x π(x) x/ ln x = 1. this tells us that there are plenty of large primes The question now is how we find prime numbers Theorem if integer n > 1 is composite, it has a prime divisor p n in other words, if n > 1 has no prime divisor p n, then it is prime 19

Finding Primes This suggests a simple algorithm for testing a small number for primality (and factoring if it is composite) Input: a positive integer n Output: whether n is prime, or one or more factors of n m = n; p = 2 while (p m) { if (m mod p = 0) { print n is composite with factor p ; m = m/p } else { p = p + 1 } } if (m = n) { print n is prime } else if (m > 1) { print the last factor of n is m } 20

Summary Today we ve learned: divisibility theorems how to use Euclidean algorithm to compute GCD and more the number of prime numbers is large and they are well distributed More on number theory is still ahead 21