Cryptology Design Fundamentals

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
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.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2002 Tuesday, 26 November Number-Theoretic Algorithms Chapter 31.
6/20/2015 5:05 AMNumerical Algorithms1 x x1x
Lecture 3.2: Public Key Cryptography II CS 436/636/736 Spring 2012 Nitesh Saxena.
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.
Peter Lam Discrete Math CS.  Sometimes Referred to Clock Arithmetic  Remainder is Used as Part of Value ◦ i.e Clocks  24 Hours in a Day However, Time.
BY MISS FARAH ADIBAH ADNAN IMK
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
Software Security Seminar - 1 Chapter 11. Mathematical Background 발표자 : 안병희 Applied Cryptography.
Mathematics of Cryptography Part I: Modular Arithmetic
Module :MA3036NI Cryptography and Number Theory Lecture Week 7
Mathematics of Cryptography Modular Arithmetic, Congruence,
Lecture 2 Basic Number Theory and Algebra. In modern cryptographic systems,the messages are represented by numerical values prior to being encrypted and.
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.
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 2015 Nitesh Saxena.
Discrete Mathematics
Lecture 2-3 Basic Number Theory and Algebra. In modern cryptographic systems, the messages are represented by numerical values prior to being encrypted.
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.
Page : 1 bfolieq.drw Technical University of Braunschweig IDA: Institute of Computer and Network Engineering  W. Adi 2011 Lecture-5 Mathematical Background:
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
CMPS 2433 – Coding Theory Chapter 3
Mathematical Background : A quick approach to Group and Field Theory
Discrete Math II Howon Kim
Mathematical Background: Groups, Rings, Finite Fields (GF)
Mathematical Background for Cryptography: Modular arithmetic and gcd
Mathematical Background: Extension Fields
B504/I538: Introduction to Cryptography
Introduction to Cryptography
Lecture 3.2: Public Key Cryptography II
Integers and Division Section 3.4.
Cryptology Design Fundamentals
Sample Solution Cryptology Design Fundamentals
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Numerical Algorithms x x-1
Applied Discrete Mathematics Week 4: Number Theory
Computer Security Modular Arithmetic November 12, 2018
Mathematical Background: Prime Numbers
Prime and Relatively Prime Numbers
Discrete Math for CS CMPSC 360 LECTURE 12 Last time: Stable matching
Week #5 – 23/25/27 September 2002 Prof. Marie desJardins
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
Mathematical Background: Primes and (GF)
Classical Ciphers – 2 CSCI284 Spring 2004 GWU
Tuesday, 27 April Number-Theoretic Algorithms Chapter 31
Lecture 3.1: Public Key Cryptography I
Cryptology Design Fundamentals
Cryptology Design Fundamentals
Cryptology Design Fundamentals
Cryptology Design Fundamentals
Cryptology Design Fundamentals
Applied Discrete Mathematics Week 10: Introduction to Counting
Cryptology Design Fundamentals
Cryptology Design Fundamentals
Cryptology Design Fundamentals
Sample Solution Cryptology Design Fundamentals
Sample Solution Final exam: Cryptology Design Fundamentals
Cryptology Design Fundamentals
Cryptology Design Fundamentals
Cryptology Design Fundamentals
Cryptology Design Fundamentals
Cryptology Design Fundamentals
Lecture 2-3 Basic Number Theory and Algebra
Mathematical Background: Groups, Rings, Finite Fields (GF)
Mathematical Background : A quick approach to Group and Field Theory
Mathematical Background: Extension Finite Fields
Presentation transcript:

Cryptology Design Fundamentals Grundlagen des kryptographischen Systementwurfs Module ID: ET-IDA-048 Lecture-2 Mathematical Background for Cryptography: Modular arithmetic and gcd 01.11.2017 v35 Prof. W. Adi

Mathematical Background In Discrete Mathematics, number theory Outlines Euclidean Algorithm, Remainder Greatest Common Divisor (gcd) Group Theory, Rings, Finite Fields Element’s Order, Euler Theorem Prime Numbers Prime Number Generation Extension Fields part 1 part 2 part 3 part 4

My deepest thanks To James Massey (ETH Zürich) for allowing me to use his lecture slides More than 35 years ago. Many slides especially in the mathematical fundamentals subjects are inspired or used modified in whole or in part from Jim Massey’s lecture slides 1934-2013

Mathematical background: number theory Number sets of interest in cryptography: Natural numbers N = 0 1 2 3 ..... Integers set Z = .... -3 -2 -1 0 1 2 3 ...... For any n  N and n >1 : => pi prime numbers r is the number of prime factors of n.

Euclidean Division theorem for integers For any Integers n and d with d  0 there is q and r, such that: n / d = q + r / d n = q d + r where 0  r < d We say: Rd (n) = r , r is Remainder of n modulo d Example: 13/5 = 2 + 3/5 or 13 = 2 . 5 + 3 In remainder algebra R5 (13) = 3

Rd (a + b ) = Rd [ Rd (a) + Rd (b) ] Remainder arithmetic Rd (a + b ) = Rd [ Rd (a) + Rd (b) ] Rd (a . b ) = Rd [ Rd (a) . Rd (b) ] Examples: R5 (7 + 14 ) = R5 [ R5 (7) + R5 (14) ] = R5 [ 2 + 4 ] = R5 (6) = 1 R5 (9 . 22 ) = R5 [ R5 (9) . R5 (22) ] = R5 [ 4 . 2 ] = R5 (8) = 3

Equivalence: Integer remainder system modulo d Rd (n) = Rd (n + i d ) where n, i are any integers Example: Remainder modulo 5: R5 (7) = R5 [7 + 3 x 5 ] = R5 [22 ] = 2 R5 (7) = R5 [7 + -2 x 5 ] = R5 [-3 ] = 2 In this remainder algebra: 22 = -3 = 2 Integers having the same remainder can be tabulated in the so called Slepian Array (or Standard Array) for d=5, all Z elements are ordered in a table of 5 cosets: r ... - 10 5 15 .... Remainder Class (coset) 1 9 4 6 11 16 2 8 3 7 12 17 13 18 14 19 Example this coset is equivalent to 3 We have a total of 5 cosets modulo 5 Coset leader

gcd: greatest common divisor gcd (m1 , m2 .... mt ) is the greatest positive integer which divides m1 , m2 .... mt without remainder. Example: gcd (15,5) = 5 If gcd (n1 , n2) = 1, then n1 , n2 are called relatively prime integers Example: gcd (15,28) = 1 => 15, 28 are relatively prime

Properties of gcd: Fundamental property of gcd: gcd (n, 0) = n (for n  0) gcd (n, 0) = ? , undefined (if n = 0) gcd (n1 , n2) = gcd (n2 , n1) gcd (n1 , n2) = gcd ( + n1 , + n2) Fundamental property of gcd: gcd (n1 , n2) = gcd ( n1 + i n2 , n2 ) or gcd (n1 , n2) = gcd ( Rn2 ( n1) , n2 ) Examples: gcd (15, 10) = gcd ( 15+10 , 10 ) = gcd ( 15-10 , 10 ) = gcd ( 15 – 2x10 , 10 ) = gcd (-5,10) Or gcd (15, 10) = gcd ( R10(15) , 10 ) = gcd ( 5 , 10 ) = gcd ( 5 , R5 (10) ) = gcd (5 , 0 ) = 5

Euclidean gcd Algorithm Example: gcd Complexity < log2 n + 1 operations n = Max [n1, n2]

Stein`s improvement for the Euclidean gcd Algorithm n1 and n2 even: gcd (n1 , n2) = 2 . gcd ( n1 / 2 , n2 / 2 ) n1 even, n2 odd: gcd (n1 , n2) = gcd ( n1 / 2 , n2 ) n1 and n2 odd: gcd (n1 , n2) = gcd [ (n1-n2) / 2 , n2 ]

Stein`s improvement for Euclidean gcd Algorithm Complexity < log2 n + 1 n= Max [n1, n2] gcd gcd

Extended Euclidean gcd Algorithm gcd (n1 , n2) = a . n1 + b . n2

Example 1 : Extended Euclidean gcd Algorithm gcd (n1 , n2) = a . n1 + b . n2 gcd (156, 117) = a 156 + b 117 find a and b n n a b a b q r computation 1 2 1 1 2 2 156 117 1 1 1 39 156/117=1+ 39/117 117 39 1 1 -1 3 a1-qa2 = 1 –1 x 0 =1 b1-qb2 = 0 – 1 x 1 = -1 gcd gcd (156, 117) = a . 156 + b . 117 = 1 . 156 + (-1) . 117 = 39 => a = 1 , b = -1

Special gcd Properties gcd (tn-1, tm-1) = t gcd (n, m) -1 Example: gcd(215-1, 220-1) = 2 gcd(15,20) - 1 = 25-1 = 31 gcd[ (x + y)15-1, (x + y)20-1 ] = (x + y)5-1 more general:

Example 2 : Extended Euclidean gcd Algorithm gcd (n1 , n2) = a . n1 + b . n2 Compute gcd (38, 7) = a x 38 + b x 7 find a and b a1-qa2 = 1 –5 x 0 =1 b1-qb2 = 0 – 5 x 1 = -5 n n a b a b q r computation 1 2 1 1 2 2 38 7 1 1 5 3 38/7=5+ 3/38 7 3 1 1 -5 2 1 7/3=2+ 1/7 0-2x1 -2 3 1 1 -5 1-2x-5 11 3 3/1=3+ 0/3 gcd gcd (38, 7) = a . 38 + b . 7 = -2 . 38 + 11 . 7 = 1 Check! -76 + 77 =1

Extended “gcd” and Multiplicative Modular Inversion If an integer is invertible under multiplication, then it is called a unit Example: 3 x 2 = 6 = 1 (mod 5) says that : 3 is the multiplicative inverse of 2 modulo 5 (2-1=3) or 2 is the multiplicative inverse of 3 modulo 5 (3-1=2) Fundamental Theorem of units: An integer u is a unit modulo m (or has a multiplicative inverse modulo m) iff (if and only if): gcd (m, u) = 1 Computation: If gcd (m, u) = 1 then a.m + b.u = 1 Rm (a m + b u) = Rm (1) Rm (b . u) = 1 => u-1 = Rm (b) Example: gcd (7, 3) = 1 = 1 . 7 - 2 . 3 R7 (1 . 7 – 2 . 3) = 1 R7 (-2 . 3) = 1 => R7 (3-1) = -2 => thus 3-1 = 5 Test: 3 . 5 = 15 = 1 (mod 7)

Example 3 : Extended gcd Algorithem and Multiplicative Inverse gcd (n1 , n2) = a . n1 + b . n2 Question: Find the multiplicative inverse of 9 modulo 11 Solution: Compute gcd (11, 9) = a x 11 + b x 9 = 1 if gcd=1, then the inverse is b ? a1-qa2 b1-qb2 n n a b a b q r computation 1 2 1 1 2 2 11 9 1 1 1 2 11/9 = 1 + 2/11 9 2 1 1 0-1x1 -1 4 1 9/2 = 4 + 1/2 0-4x1 -4 1-4x-1 5 2 1 1 -1 2 2/1=2+ 0/1 gcd gcd (11,9) = a . 11 + b . 9 = -4 . 11 + 5 . 9 = 1 Check! -44 + 45 =1 mod 11 => 0 + 5 x 9 = 1 (mod 11) => 5 x 9 mod 11 =1 => 9-1 mod 11 = 5

Stein`s improvement for the extended Euclidean gcd Algorithm (Source: J. Massey ETH Zürich)

General Solution as Excel Sheet: Solution: Compute gcd (156, 17) = a x 156 + b x 17 = 1 if gcd=1, then the inverse is b Check: 17 x - 55 = -155 = -155+156 = 1 mod 156 Or 17-1= -55 = -55 +156 = 101 Check: 17 x 101 = 1717 = 1 mod 156