Module :MA3036NI Cryptography and Number Theory Lecture Week 7

Slides:



Advertisements
Similar presentations
1 Lect. 12: Number Theory. Contents Prime and Relative Prime Numbers Modular Arithmetic Fermat’s and Euler’s Theorem Extended Euclid’s Algorithm.
Advertisements

Cryptography and Network Security
1 Section 2.4 The Integers and Division. 2 Number Theory Branch of mathematics that includes (among other things): –divisibility –greatest common divisor.
Chapter Primes and Greatest Common Divisors ‒Primes ‒Greatest common divisors and least common multiples 1.
CSC2110 Discrete Mathematics Tutorial 5 GCD and Modular Arithmetic
6/20/2015 5:05 AMNumerical Algorithms1 x x1x
Chapter 4 – Finite Fields Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic Curve, IDEA, Public.
Lecture 3.2: Public Key Cryptography II CS 436/636/736 Spring 2012 Nitesh Saxena.
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
Great Theoretical Ideas in Computer Science.
CSE 311 Foundations of Computing I Lecture 12 Primes, GCD, Modular Inverse Spring
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
CS555Spring 2012/Topic 61 Cryptography CS 555 Topic 6: Number Theory Basics.
BY MISS FARAH ADIBAH ADNAN IMK
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
Great Theoretical Ideas in Computer Science.
1 Properties of Integers Objectives At the end of this unit, students should be able to: State the division algorithm Apply the division algorithm Find.
9/2/2015Discrete Structures1 Let us get into… Number Theory.
Mathematics of Cryptography Part I: Modular Arithmetic
February 24, 2015Applied Discrete Mathematics Week 4: Number Theory 1 Modular Arithmetic Let a be an integer and m be a positive integer. We denote by.
Mathematics of Cryptography Modular Arithmetic, Congruence,
CPSC 3730 Cryptography and Network Security
1 Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown Chapter 4 – Finite Fields.
Modular Arithmetic with Applications to Cryptography Lecture 47 Section 10.4 Wed, Apr 13, 2005.
CompSci 102 Discrete Math for Computer Science
YSLInformation Security -- Public-Key Cryptography1 Prime and Relatively Prime Numbers Divisors: We say that b  0 divides a if a = mb for some m, where.
Chinese Remainder Theorem Dec 29 Picture from ………………………
Section 2.2: Affine Ciphers; More Modular Arithmetic Shift ciphers use an additive key. To increase security, we can add a multiplicative parameter. –For.
Information Security Lab. Dept. of Computer Engineering 87/121 PART I Symmetric Ciphers CHAPTER 4 Finite Fields 4.1 Groups, Rings, and Fields 4.2 Modular.
Lecture 6.1: Misc. Topics: Number Theory CS 250, Discrete Structures, Fall 2011 Nitesh Saxena.
1 Section Congruences In short, a congruence relation is an equivalence relation on the carrier of an algebra such that the operations of the algebra.
MA/CSSE 473 Day 08 Extended Euclid's Algorithm Modular Division Fermat's little theorem.
Tuesday’s lecture: Today’s lecture: One-way permutations (OWPs)
The Euclidean Algorithm That’s right, it’s real..
Discrete Mathematics 4. NUMBER THEORY Lecture 7 Dr.-Ing. Erwin Sitompul
Lecture 3.1: Public Key Cryptography I CS 436/636/736 Spring 2015 Nitesh Saxena.
Cryptography Lecture 14 Arpita Patra © Arpita Patra.
Divisibility and Modular Arithmetic
AF2. Turn off your phones Primes, gcd, some examples, reading.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 2 The Fundamentals: Algorithms,
Chapter 4 With Question/Answer Animations 1. Chapter Summary Divisibility and Modular Arithmetic - Sec 4.1 – Lecture 16 Integer Representations and Algorithms.
Ch04-Number Theory and Cryptography 1. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 3. Mathematics of Cryptography.
Chapter 4 With Question/Answer Animations 1. Chapter Motivation Number theory is the part of mathematics devoted to the study of the integers and their.
Number Theory Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
Number Theory. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility,
Number-Theoretic Algorithms
Lecture 4 The Euclidean Algorithm
Discrete Math II Howon Kim
Mathematics of Cryptography
B504/I538: Introduction to Cryptography
Advanced Algorithms Analysis and Design
Introduction to Cryptography
Lecture 3.2: Public Key Cryptography II
Integers and Division Section 3.4.
Numerical Algorithms x x-1 Numerical Algorithms
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Number Theory and Modular Arithmetic
Numerical Algorithms x x-1
Applied Discrete Mathematics Week 4: Number Theory
Number Theory (Chapter 7)
Prime and Relatively Prime Numbers
Lecture 20 Guest lecturer: Neal Gupta
Week #5 – 23/25/27 September 2002 Prof. Marie desJardins
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
Lecture 3.1: Public Key Cryptography I
CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston
Applied Discrete Mathematics Week 10: Introduction to Counting
Cryptography Lecture 16.
Discrete Mathematics Chapter 4 Number Theory. Discrete Mathematics Chapter 4 Number Theory.
Presentation transcript:

Module :MA3036NI Cryptography and Number Theory Lecture Week 7

Quotient remainder theorem, GCD and Euclid's algorithm The quotient remainder theorem For any two integers a and b with b > 0, there are unique integers q and r such that a = qb + r with 0 ≤ r < b, then q is called the quotient and r is called the remainder when a is divided by b.

Greatest common divisor (GCD) Definition A positive integer d is said to be the greatest common divisor of a and b (a, b not both zero) if and only if (i) d is a common divisor of a and b, i.e. d|a and d|b, (ii) any common divisor of a and b is a divisor of d, i.e. if x|a and x|b then x|d. We then write d = gcd(a, b).

Greatest common divisor (GCD) Note (i) The gcd(a, b) is the largest positive integer that divides a and b. (ii) gcd(0, n) = |n| if n is not 0. (iii) If gcd(a, b) = 1 then a and b are said to be relatively prime or co prime. Example Find the answers to the following: (i) gcd(12, 18), (ii) gcd(-12, 18), (iii) gcd(35, 49), (iv) gcd(0, -5), (v) gcd(3, 4), (vi) gcd(3, 9), (vii) gcd(0, 5).

The Euclidean Algorithm Euclid’s algorithm to find gcd(a, b) (1) Assume a ≥ b > 0 (else interchange a and b). (2) Write a = qb + r where 0 ≤ r < b. (3) IF r = 0 THEN b is the gcd(a, b). STOP ELSE replace (a, b) by (b, r) and continue with step (2).

The Euclidean Algorithm Example Find gcd(1598, 282) using Euclid’s algorithm. Solution, a b r 1598 = 5 * 282 + 188 282 = 1 * 188 + 94 188 = 2 * 94 + 0 Thus gcd(1598, 282) = 94.

The Euclidean Algorithm Note For any two positive integers a and b, gcd(a, b) exists, (ii) there exist integers m, n € Z such that gcd(a,b) = ma + nb.

The Euclidean Algorithm Example (i) Find the gcd(2403, 663) using Euclid’s algorithm. (ii) Write gcd(2403, 663) in the form m × 2403 + n × 663 where m, n € Z.

linear Diophantine equation A linear Diophantine equation of two variables is ax + by = c. Particular solution: x0 = (c/d)m and y0 = (c/d)n General solutions: x = x0 + k (b / d) and y = y0 − k(a / d) where k is an integer

Exercises….. Q.Find the particular and general solutions to the following Diophantine equations i) 24x + 36y = 54 ii) 10x + 25y =100 iii) 6x +13y = 20

Modular Arithmetic define modulo operator “a mod n” to be remainder when a is divided by n where integer n is called the modulus a & b are congruent if: a mod n = b mod n when divided by n, a & b have same remainder This is written as a ≡ b mod n e.g.. 100 ≡ 34 mod 11 Given any positive integer n and any nonnegative integer a, if we divide a by n, we get an integer quotient q and an integer remainder r. In modular arithmetic we are only interested in the remainder (or residue) after division by some modulus, and results with the same remainder are regarded as equivalent. Two integers a and b are said to be congruent modulo n, if (a mod n) =(b mod n).

Modular Arithmetic

Modular Arithmetic Operations [(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) x (b mod n)] mod n = (a x b) mod n Verify the above properties using suitable examples . Modular arithmetic exhibits the properties shown, see text for details & proofs. Here are examples of the three properties: Given 11 mod 8 = 3; 15 mod 8 = 7 [(11 mod 8) + (15 mod 8)] mod 8 = 10 mod 8 = 2 (11 + 15) mod 8 = 26 mod 8 = 2 [(11 mod 8) – (15 mod 8)] mod 8 = –4 mod 8 = 4 (11 – 15) mod 8 = –4 mod 8 = 4 [(11 mod 8) x (15 mod 8)] mod 8 = 21 mod 8 = 5 (11 x 15) mod 8 = 165 mod 8 = 5

Modular Arithmetic (cont’d) Proof of Property 1: Define (a mod n) = ra and (b mod n) = rb. Then a = ra + jn and b = rb + kn for some integers j and k. Then, (a+b) mod n = (ra + jn + rb + kn) mod n = (ra + rb + (j + k)n) mod n = (ra + rb) mod n = [(a mod n) + (b mod n)] mod n. Prove Property 2 and 3 in similar manner

Modular Arithmetic (cont’d) Exponentiation is performed by repeated multiplication, as in ordinary arithmetic. Thus the rules for ordinary arithmetic involving addition, subtraction and multiplication carry over into modular arithmetic . To find 11⁷ mod 13, we can proceed as follows: 11² = 121≡ 4 (mod 13) 11⁴= (11²)²≡ 4² ≡ 3 (mod 13) 11⁷≡11*4 *3 ≡132≡2 (mod 13) Find 12⁹ mod 13 .

Modulo 8 Addition Example + 1 2 3 4 5 6 7 Example showing addition in GF(8), from Stallings Table 4.2a. Table 4.2 provides an illustration of modular addition and multiplication modulo 8. Looking at addition, the results are straightforward and there is a regular pattern to the matrix. Both matrices are symmetric about the main diagonal, in conformance to the commutative property of addition and multiplication. As in ordinary addition, there is an additive inverse, or negative, to each integer in modular arithmetic. In this case, the negative of an integer x is the integer y such that (x + y) mod 8 = 0. To find the additive inverse of an integer in the left-hand column, scan across the corresponding row of the matrix to find the value 0; the integer at the top of that column is the additive inverse; thus (2 + 6) mod 8 = 0.

Modulo 8 Multiplication ₓ 1 2 3 4 5 6 7 Continuing the example showing multiplication in GF(8), from Stallings Table 4.2b. Both matrices are symmetric about the main diagonal, in conformance to the commutative property of addition and multiplication. Similarly, the entries in the multiplication table are straightforward. In ordinary arithmetic, there is a multiplicative inverse, or reciprocal, to each integer. In modular arithmetic mod 8, the multiplicative inverse of x is the integer y such that (x x y) mod 8 = 1 mod 8. Now, to find the multiplicative inverse of an integer from the multiplication table, scan across the matrix in the row for that integer to find the value 1; the integer at the top of that column is the multiplicative inverse; thus (3 x 3) mod 8 = 1. Note that not all integers mod 8 have a multiplicative inverse; more about that later.

Modular Arithmetic Properties Let Zn = {0,1,2,…,(n-1)} be the set of residues modulo n. If we perform modular arithmetic within Zn, the properties shown in Table 4.3 hold for integers in Zn We show in the next section that this implies that Zn is a commutative ring with a multiplicative identity element. Note that unlike ordinary arithmetic, the following statement is true only with the attached condition: if (a x b) = (a x c) (mod n) then b = c (mod n) if a is relatively prime to n In general, an integer has a multiplicative inverse in Zn if that integer is relatively prime to n. Table 4.2 cin the text shows that the integers 1, 3, 5, and 7 have a multiplicative inverse in Z 8, but 2, 4, and 6 do not.

Additive Inverse In Zn, two numbers a and b are additive inverses of each other if In modular arithmetic, each integer has an additive inverse. The sum of an integer and its additive inverse is congruent to 0 modulo n.

Find all additive inverse pairs in Z10. Solution The six pairs of additive inverses are (0, 0), (1, 9), (2, 8), (3, 7), (4, 6), and (5, 5).

Multiplicative Inverse In Zn, two numbers a and b are the multiplicative inverse of each other if In modular arithmetic, an integer may or may not have a multiplicative inverse. When it does, the product of the integer and its multiplicative inverse is congruent to 1 modulo n.

Find the multiplicative inverse of 8 in Z10. Solution There is no multiplicative inverse because gcd (10, 8) = 2 ≠ 1. In other words, we cannot find any number between 0 and 9 such that when multiplied by 8, the result is congruent to 1. Find all multiplicative inverses in Z10. Solution There are only four pairs: (1, 1), (3, 7) , (7 , 3)and (9, 9). The numbers 0, 2, 4, 5, 6, and 8 do not have a multiplicative inverse.

Find all multiplicative inverse pairs in Z11. Solution We have seven pairs: (1, 1), (2, 6), (3, 4), (5, 9), (7, 8), (9, 9), and (10, 10).

Addition and Multiplication Tables Z10

Extended Euclidian algorithm to find Multiplicative inverse If we perform modular arithmetic within Zn, the properties shown in Table 4.3 hold for integers in Zn We show in the next section that this implies that Zn is a commutative ring with a multiplicative identity element. Note that unlike ordinary arithmetic, the following statement is true only with the attached condition: if (a x b) = (a x c) (mod n) then b = c (mod n) if a is relatively prime to n In general, an integer has a multiplicative inverse in Zn if that integer is relatively prime to n. Table 4.2 cin the text shows that the integers 1, 3, 5, and 7 have a multiplicative inverse in Z 8, but 2, 4, and 6 do not.

Fermat's Theorem Fermat’s theorem states that, ap-1 mod p = 1 where p is prime and gcd(a , p)=1 Proof : See section 8.2 from book

Euler's Theorem A generalisation of Fermat's Theorem, Which States that , aø(n)mod n = 1 where gcd(a , n)=1 Proof: See section 8.2 from book

Extended Euclidian Algorithm Question: Using the Extended Euclidean Algorithm , find the multiplicative inverse of 1234 mod 4321. ( Note :d = 1234 f = 4321)