Computer Security: Art and Science, 2nd Edition

Slides:



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

Cryptography and Network Security
Section 4.1: Primes, Factorization, and the Euclidean Algorithm Practice HW (not to hand in) From Barr Text p. 160 # 6, 7, 8, 11, 12, 13.
Quotient-Remainder Theory, Div and Mod
NUMBER THEORY Chapter 1: The Integers. The Well-Ordering Property.
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.
June 1, 2004Computer Security: Art and Science © Matt Bishop Slide #31-1 Chapter 31: Euclidean Algorithm Euclidean Algorithm Extended Euclidean.
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 7 Tuesday, 11/6/01 Number-Theoretic Algorithms Chapter.
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.
Mathematics of Cryptography Part I: Modular Arithmetic
COMP 170 L2 Page 1 L05: Inverses and GCDs l Objective: n When does have an inverse? n How to compute the inverse? n Need: Greatest common dividers (GCDs)
Module :MA3036NI Cryptography and Number Theory Lecture Week 7
Mathematics of Cryptography Modular Arithmetic, Congruence,
CPSC 3730 Cryptography and Network Security
6.5 – Solving Equations with Quadratic Techniques.
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 –
Chapter 4 – Finite Fields
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.
Greatest Common Divisor Jordi Cortadella Department of Computer Science.
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.
Lecture 6.1: Misc. Topics: Number Theory CS 250, Discrete Structures, Fall 2011 Nitesh Saxena.
Math 409/409G History of Mathematics Books VII – IX of the Elements Part 1: Divisibility.
MA/CSSE 473 Day 08 Extended Euclid's Algorithm Modular Division Fermat's little theorem.
Modular Arithmetic and the RSA Cryptosystem Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2005 Lecture 9Sept 27, 2005Carnegie.
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.
Lecture 3.1: Public Key Cryptography I CS 436/636/736 Spring 2012 Nitesh Saxena.
Lecture 3.1: Public Key Cryptography I CS 436/636/736 Spring 2015 Nitesh Saxena.
CSE 311: Foundations of Computing Fall 2013 Lecture 12: Primes, GCD, modular inverse.
Discrete Mathematics
Chapter 4 With Question/Answer Animations 1. Chapter Summary Divisibility and Modular Arithmetic - Sec 4.1 – Lecture 16 Integer Representations and Algorithms.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 3. Mathematics of Cryptography.
Number Theory Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
Great Theoretical Ideas in Computer Science.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Revision. Cryptography depends on some properties of prime numbers. One of these is that it is rather easy to generate large prime numbers, but much harder.
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
Mathematical Background for Cryptography: Modular arithmetic and gcd
Mathematics of Cryptography
CSE 311 Foundations of Computing I
Cryptology Design Fundamentals
Cryptology Design Fundamentals
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Numerical Algorithms x x-1
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Number Theory (Chapter 7)
Topic 6: Number Theory Basics
Discrete Math for CS CMPSC 360 LECTURE 12 Last time: Stable matching
Modular Arithmetic and the RSA Cryptosystem
Lecture 3.1: Public Key Cryptography I
Computer Security: Art and Science, 2nd Edition
Modular Inverses Recall the simple encryption function
Applied Discrete Mathematics Week 10: Introduction to Counting
Miniconference on the Mathematics of Computation
Number Theory.
Cryptography Lecture 16.
Presentation transcript:

Computer Security: Art and Science, 2nd Edition Euclidean Algorithm Appendix B Version 1.0 Computer Security: Art and Science, 2nd Edition

Computer Security: Art and Science, 2nd Edition Outline Overview Definitions Lattices Examples Version 1.0 Computer Security: Art and Science, 2nd Edition

Computer Security: Art and Science, 2nd Edition Overview Solving modular equations arises in cryptography Euclidean Algorithm From Euclid to solving ax mod n = 1 From ax mod n = 1 to solving ax mod n = b Version 1.0 Computer Security: Art and Science, 2nd Edition

Computer Security: Art and Science, 2nd Edition Euclidean Algorithm Given positive integers a and b, find their greatest common divisor Idea if x is the greatest common divisor of a and b, then x divides r = a – b reduces problem to finding largest x that divides r and b iterate Version 1.0 Computer Security: Art and Science, 2nd Edition

Computer Security: Art and Science, 2nd Edition Relation Properties Take a = 15, b = 12 a b q r 15 12 1 3 q = 15/12 = 1 r = 15 – 112 = 3 12 3 4 0 q = 12/3 = 4 r = 12 – 43 = 0 So gcd(15, 12) = 3 The b for which r is 0 Version 1.0 Computer Security: Art and Science, 2nd Edition

Computer Security: Art and Science, 2nd Edition Example 2 Take a = 35731, b = 25689 a b q r 35731 24689 1 11042 q = 35731/24689 = 1 r = 35731–124689 = 11042 24689 11042 2 2605 q = 24689/11042 = 2 r = 24689–211042 = 2605 11042 2605 4 622 q = 11042/2605 = 4 r = 11042–42605 = 622 2605 622 4 117 q = 2605/622 = 4 r = 2605–4622 = 117 622 117 5 37 q = 622/117 = 5 r = 622–5117 = 37 117 37 3 6 q = 117/37 = 3 r = 117–337 37 6 6 1 q = 37/6 = 6 r = 37–66 = 1 6 1 6 0 q = 6/1 = 6 r = 6–61 = 0 Version 1.0 Computer Security: Art and Science, 2nd Edition

Computer Security: Art and Science, 2nd Edition Pseudocode /* find gcd of a and b */ rprev := r := 1; while r <> 0 do begin rprev := r; r := a mod b; write 'a = ', a, 'b =', b, 'q = ‘, a div b, 'r = ', r, endline; a := b; b := r; end; gcd := rprev; Version 1.0 Computer Security: Art and Science, 2nd Edition

Extended Euclidean Algorithm Find two integers x and y such that xa + yb = 1 Version 1.0 Computer Security: Art and Science, 2nd Edition

Computer Security: Art and Science, 2nd Edition Example 1 Find x and y such that 51x + 100y = 1 u x y q 100 0 1 51 1 0 100/51 = 1 u = 100–151 = 49 x = 0–11 = –1 y = 1–10 = 1 49 –1 1 51/49 = 1 u = 51–149 = 2 x = 0–11 = –1 y = 1–10 = 1 2 2 –1 49/2 = 24 u = 49 –242 = 1 x = 1–1(–1)=2 y = 0–11=–1 1 –49 25 2/1 = 2 u = 2–21 = 0 x = –1–241 = –49 y = 1–24(–1)=25 0 100 –51 x = 2–492 = 100 y = –1–252 = –51 So, 51  (–49) + 100  25 = 1 This is –2499 + 2500 = 1 Version 1.0 Computer Security: Art and Science, 2nd Edition

Computer Security: Art and Science, 2nd Edition Example 2 Find x and y such that 24689x + 35731y = 1 u x y q 35731 0 1 24689 1 0 35731/24689 = 1 u = 35721–124689 x = 0–11 y = 1–1 11042 –1 1 24689/11042 = 2 u = 24689–211042 x = 1–2(–1) y = 0–21 2605 3 –2 11042/2605 = 4 u = 11042–42605 x = –1–43 y = 1–4(–2) 622 –13 9 2605/622 = 4 u = 2605–4622 x = 3–4(–13) y = –2–49 117 55 –38 622/117 = 5 u = 622–5117 x = –13–555 y = 9–5(–38) 37 –288 199 117/37 = 3 u = 117–337 x = 55–3(–288) y = –38–3199 6 919 –635 37/6 = 6 u = 37–66 x = –288–6919 y = 199–6(–635) 1 –5802 4009 6/1=6 u = 6–61 x = 919–6(–5802) y = –635–6(4009) 0 35731 –24689 So, 24689  (–5802) + 35731  4009 = 1 Version 1.0 Computer Security: Art and Science, 2nd Edition

Computer Security: Art and Science, 2nd Edition Pseudocode /* find x and y such that ax + by = 1, for given a and b */ uprev := a; u := b; xprev := 0; x := 1; yprev := 1; y := 0; write 'u = ', uprev, ' x = ', xprev, ' y = ', yprev, endline; write 'u = ', u, ' x = ', x, ' y = ', y; while u <> 0 do begin q := uprev div u; write 'q = ', q, endline; utmp := uprev – u * q; uprev := u; u := utmp; xtmp := xprev – x * q; xprev := x; x := xtmp; ytmp := yprev – y * q; yprev := y; y := ytmp; end; write endline; x := xprev; y := yprev; Version 1.0 Computer Security: Art and Science, 2nd Edition

Computer Security: Art and Science, 2nd Edition Solving ax mod n = 1 If ax mod n = 1 then choose k such that ax = 1 + kn, or ax – kn = 1. If b = –k, then ax + bn = 1. Use extended Euclidean algorithm to solve for a Version 1.0 Computer Security: Art and Science, 2nd Edition

Computer Security: Art and Science, 2nd Edition Example Solve for x: 51x mod 100 = 1 Recall (from earlier example) 51  (–49) + 100  25 = 1 Then x = –49 mod 100 = 51 Solve for x: 24689 mod 35731 = 1 24689  (–5802) + 35731  4009 = 1 Then x = –5802 mod 35731 = 29929 Version 1.0 Computer Security: Art and Science, 2nd Edition

Solving ax mod n = b A fundamental law of modular arithmetic: xy mod n = (x mod n)(y mod n) mod n so if x solves ax mod n = 1, then as b(ax mod n) = a(bx) mod n = b bx solves ax mod n = b Version 1.0 Computer Security: Art and Science, 2nd Edition

Computer Security: Art and Science, 2nd Edition Example Solve for x: 51x mod 100 = 10 Recall (from earlier example) that if 51y mod 100 = 1, then y = 51. Then x = 10  51 mod 100 = 510 mod 100 = 10 Solve for x: 24689 mod 35731 = 1753 24689y mod 35731 = 1, then y = 29929. Then x = 1753  29929 mod 35731 = 12429 Version 1.0 Computer Security: Art and Science, 2nd Edition