Cryptography Inverses and GCD Piotr Faliszewski. GCD(a,b) gcd(a, 0) = a gcd(a, b) = gcd(b, a mod b) a = b*q + r Here: q =  a / b  r = a mod b (a –

Slides:



Advertisements
Similar presentations
Euclidean Algorithm Applied Symbolic Computation CS 567 Jeremy Johnson.
Advertisements

Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 2.3 Basic Number Theory.
Dr. Sharon Persinger October 30,  Recursion is a type of repetition used in mathematics and computing to create objects and to define functions.
Announcements: Subscribe to Angel forums Subscribe to Angel forumsQuestions? Roll Call Today: affine ciphers DTTF/NB479: DszquphsbqizDay 2.
Announcements: Homework 1 returned. Comments from Kevin? Homework 1 returned. Comments from Kevin? Matlab: tutorial available at
6/20/2015 5:05 AMNumerical Algorithms1 x x1x
Theory of Computation Transparency No. 1-1 Chapter 2 Introduction to Number Theory and Its applications Cheng-Chia Chen October 2002.
Chapter 4 – Finite Fields Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic Curve, IDEA, Public.
Theory of Computation Transparency No. 1-1 Chapter 2 Introduction to Number Theory and Its applications Cheng-Chia Chen October 2005.
CS555Spring 2012/Topic 61 Cryptography CS 555 Topic 6: Number Theory Basics.
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.
Divisibility October 8, Divisibility If a and b are integers and a  0, then the statement that a divides b means that there is an integer c such.
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.
3.4/3.5 The Integers and Division/ Primes and Greatest Common Divisors Let each of a and b be integers. We say that a divides b, in symbols a | b, provided.
Module :MA3036NI Cryptography and Number Theory Lecture Week 7
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.
Prelude to Public-Key Cryptography Rocky K. C. Chang, February
The Integers. The Division Algorithms A high-school question: Compute 58/17. We can write 58 as 58 = 3 (17) + 7 This forms illustrates the answer: “3.
CompSci 102 Discrete Math for Computer Science
Chapter 4 – Finite Fields
Rational Numbers and Fields
Section 2.2: Affine Ciphers; More Modular Arithmetic Shift ciphers use an additive key. To increase security, we can add a multiplicative parameter. –For.
CSE 311: Foundations of Computing Fall 2014 Lecture 12: Primes, GCD.
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.
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.
Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder.
CS Modular Division and RSA1 RSA Public Key Encryption To do RSA we need fast Modular Exponentiation and Primality generation which we have shown.
MA/CSSE 473 Day 08 Extended Euclid's Algorithm Modular Division Fermat's little theorem.
Cryptography and Network Security Chapter 4. Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic.
CSE 311 Foundations of Computing I Lecture 14 Euclid’s Algorithm Mathematical Induction Autumn 2012 CSE
Tuesday’s lecture: Today’s lecture: One-way permutations (OWPs)
Computing k th Roots Quickly (4/4) Via the Fast Exp algorithm, we know we can quickly compute large powers of large numbers modulo large numbers. What.
Application: Algorithms Lecture 20 Section 3.8 Wed, Feb 21, 2007.
The Euclidean Algorithm That’s right, it’s real..
Properties of the gcd Theorem: For any two integers a,b there exist integers x,y such that xa + yb = gcd(a,b). A proof will not be given at this point.
Ref: Pfleeger96, Ch.31 Properties of Arithmetic Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996.
Introduction to Number Theory Department of Computer Engineering Sharif University of Technology 3/8/2006.
CSE 311: Foundations of Computing Fall 2013 Lecture 12: Primes, GCD, modular inverse.
CS 312: Algorithm Analysis Lecture #4: Primality Testing, GCD This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
Application: Algorithms Lecture 19 Section 3.8 Tue, Feb 20, 2007.
Chapter 1 Algorithms with Numbers. Bases and Logs How many digits does it take to represent the number N >= 0 in base 2? With k digits the largest number.
AF2. Turn off your phones Primes, gcd, some examples, reading.
CS/COE 1501 Recitation RSA Encryption/Decryption Extended Euclidean Algorithm Digital Signatures.
Ch04-Number Theory and Cryptography 1. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic.
Number Theory Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
Number-Theoretic Algorithms
Discrete Math II Howon Kim
Advanced Algorithms Analysis and Design
Advanced Algorithms Analysis and Design
Numerical Algorithms x x-1 Numerical Algorithms
CSE 311 Foundations of Computing I
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Numerical Algorithms x x-1
Number Theory (Chapter 7)
CS/COE 1501 Recitation RSA Encryption/Decryption
Topic 6: Number Theory Basics
Week #5 – 23/25/27 September 2002 Prof. Marie desJardins
CSE 311: Foundations of Computing
Algorithmic Number Theory and Cryptography (CS 303) Modular Arithmetic
Assignment #1 Solutions
CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston
Application: Algorithms
Application: Algorithms
Miniconference on the Mathematics of Computation
Miniconference on the Mathematics of Computation
Useful GCD Fact If a and b are positive integers, then gcd(a,b) = gcd(b, a mod b) Proof: By definition of mod, a = qb+ (a mod b) for.
Presentation transcript:

Cryptography Inverses and GCD Piotr Faliszewski

GCD(a,b) gcd(a, 0) = a gcd(a, b) = gcd(b, a mod b) a = b*q + r Here: q =  a / b  r = a mod b (a – b*q) Key idea  express the first argument in terms of the second

Multiplicative Inverse Let a, n – two integers A number a -1 s.t.  a*a -1 = 1 (mod n) is called a multiplicative inverse of a Theorem if gcd(a,b) = d then there are integers x and y s.t., ax + by = d

Multiplicative Inverse Let a, n – two integers If gcd( a, n ) = 1 then  there are integers x,y: ax + ny = 1  then, x is a -1 Note ax + ny = 1 (mod n) ax = 1 (mod n) Theorem if gcd(a,b) = d then there are integers x and y s.t., ax + by = d

Computing x,y via GCD gcd(a,b), r 0 =a, r 1 = b  gcd( r 0, r 1 )  r 0 = q 1 r 1 + r 2  r 1 = q 2 r 2 + r 3  r 2 = q 3 r 3 + r 4 ...  r k-1 = q k r k + r k+1  r k = q k+1 r k+1 +0 Idea:  sequences (x i ) and (y i )  r i = ax i + by i  build as you go

Computing x,y via GCD gcd(a,b), r 0 =a, r 1 = b  gcd( r 0, r 1 )  r 0 = q 1 r 1 + r 2  r 1 = q 2 r 2 + r 3  r 2 = q 3 r 3 + r 4 ...  r k-1 = q k r k + r k+1  r k = q k+1 r k+1 +0 x 0 = 1,y 0 = 0 x 1 = 0,y 1 = 1 x 2 = x 0 - q 1 x 1,y 2 = y 0 - q 1 y 1 x 3 = x 1 - q 2 x 2,y 3 = y 1 - q 2 y 2 x 4 = x 2 - q 3 x 3,y 4 = y 2 - q 3 y 3... r k+1 = ax k+1 + by k+1 x j+1 = x j-1 – q j x j y j+1 = y j-1 – q j y j

Example: GCD(45, 20) gcd(a,b), r 0 =45, r 1 = 20  gcd( 45, 20 )  r 0 = q 1  r 1 + r 2  45 = 2   r 1 = q 2  r 2 + r 3  20 = 4  x 0 = 1,y 0 = 0 x 1 = 0,y 1 = 1 x 2 = x 0 - q 1 x 1,y 2 = y 0 - q 1 y 1 x 2 = 1 – 2  0,y 2 = 0 – 2  1 x 2 = 1,y 2 = -2 r 3 = 0  computation ended gcd(45, 20) = 5 = 45  1 – 2  20

Example: GCD(19, 7) gcd(a,b), r 0 =19, r 1 = 7  gcd( 19, 7 )  19 = 2   7 = 1   5 = 2   2 = 2  x 0 = 1,y 0 = 0 x 1 = 0,y 1 = 1 x 2 = 1 – 2  0 = 1 y 2 = 0 – 2  1 = -2 x 3 = 0 – 1  1 = -1 y 3 = 1 – 1  (-2) = 3 x 4 = 1 – 2  (-1) = 3 y 4 = -2 – 2  (3) =   (-8) = = 1

Solving Linear Congruences Problem:  Solve 7x = 10 (mod 19) 11  7 = 1 (mod 19) Thus (11  7)x = 11  10 (mod 19) x = 110 (mod 19) x = 15 (mod 19) Getting the inverse  via GCD  we know that gcd(19, 7) = 1 7*(-8) + 19*3 = 1  -8 is the multiplicative inverse of 7 (mod 19)  -8 = = 11 (mod 19)