SlideShare uma empresa Scribd logo
1 de 32
9. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations
9. 9.1.1  Definition Figure 9.1  Three groups of positive integers A prime is divisible only by itself and 1. Note
9. 9.1.1   Continued What is the smallest prime? Example 9.1 Solution The smallest prime is 2, which is divisible by 2 (itself) and 1.  List the primes smaller than 10. Example 9.2 Solution There are four primes less than 10: 2, 3, 5, and 7. It is interesting to note that the percentage of primes in the range 1 to 10 is 40%. The percentage decreases as the range increases.
9. 9.1.2  Cardinality of Primes Infinite Number of Primes There is an infinite number of primes. Number of Primes Note
9. 9.1.2   Continued As a trivial example, assume that the only primes are in the set  {2, 3, 5, 7, 11, 13, 17}. Here P = 510510 and P + 1 = 510511. However, 510511 = 19 × 97 × 277; none of these primes were in the original list. Therefore, there are three primes greater than 17. Example 9.3 Find the number of primes less than 1,000,000. Example 9.4 Solution The approximation gives the range 72,383 to 78,543. The actual number of primes is 78,498.
9. Given a number n, how can we determine if n is a prime? The answer is that we need to see if the number is divisible by all primes less than 9.1.3  Checking for Primeness We know that this method is inefficient, but it is a good start.
9. 9.1.3   Continued Is 97 a prime? Example 9.5 Is 301 a prime? Example 9.6 Solution The floor of   97 = 9. The primes less than 9 are 2, 3, 5, and 7. We need to see if 97 is divisible by any of these numbers. It is not, so 97 is a prime. Solution The floor of   301 = 17. We need to check 2, 3, 5, 7, 11, 13, and 17. The numbers 2, 3, and 5 do not divide 301, but 7 does. Therefore 301 is not a prime.
9. Sieve of Eratosthenes 9.1.3  Continued
9. Euler’s phi-function,   (n), which is sometimes called the Euler’s totient function  plays a very important role in cryptography.  9.1.4  Euler’s Phi-Function
9. We can combine the above four rules to find the value of   (n). For example, if n can be factored as  n = p 1 e 1   × p 2 e 2  × … × p k e k  then we combine the third and the fourth rule to find 9.1.4  Continued The difficulty of finding   (n) depends on the difficulty of finding the factorization of  n . Note
9. 9.1.4   Continued What is the value of   (13)? Example 9.7 Solution Because 13 is a prime,   (13) = (13 −1) = 12. What is the value of   (10)? Example 9.8 Solution We can use the third rule:   (10) =   (2) ×   (5) = 1 × 4 = 4, because 2 and 5 are primes.
9. 9.1.4   Continued What is the value of   (240)? Example 9.9 Solution We can write 240 = 2 4  × 3 1  × 5 1 . Then  (240) = (2 4  −2 3 ) × (3 1  − 3 0 ) × (5 1  − 5 0 ) = 64 Can we say that   (49) =   (7) ×   (7) = 6 × 6 = 36? Example 9.10 Solution No. The third rule applies when  m  and  n  are relatively prime. Here 49 = 7 2 . We need to use the fourth rule:   (49) = 7 2  − 7 1  = 42.
9. 9.1.4   Continued What is the number of elements in Z 14 *? Example 9.11 Solution The answer is   (14) =   (7) ×   (2) = 6 × 1 = 6. The members are 1, 3, 5, 9, 11, and 13. Interesting point: If  n  > 2, the value of   ( n ) is even. Note
9. 9.1.5  Fermat’s Little Theorem First Version a p  ≡ a mod p a p − 1  ≡ 1 mod p Second Version
9. 9.1.5   Continued Find the result of 6 10  mod 11. Example 9.12 Solution We have 6 10  mod 11 = 1. This is the first version of Fermat’s little theorem where  p  = 11. Find the result of 3 12  mod 11. Example 9.13 Solution Here the exponent (12) and the modulus (11) are not the same. With substitution this can be solved using Fermat’s little theorem.
9. Multiplicative Inverses   9.1.5  Continued a −1  mod p = a  p − 2  mod p The answers to multiplicative inverses modulo a prime can be found without using the extended Euclidean algorithm: Example 9.14
9. 9.1.6  Euler’s Theorem First Version a  (n)  ≡ 1 (mod n) Second Version a  k ×   (n) + 1  ≡  a (mod n) The second version of Euler’s theorem is used in the RSA cryptosystem in Chapter 10. Note
9. 9.1.5   Continued Find the result of 6 24  mod 35. Example 9.15 Solution We have 6 24  mod 35 = 6  (35)  mod 35 = 1. Find the result of 20 62  mod 77. Example 9.16 Solution If we let  k  = 1 on the second version, we have  20 62  mod 77 = (20 mod 77) (20  (77)   + 1  mod 77) mod 77  = (20)(20) mod 77 = 15.
9. Multiplicative Inverses  Euler’s theorem can be used to find multiplicative inverses modulo a composite.  9.1.6  Continued a −1  mod n = a  (n)−1  mod n
9. 9.1.5   Continued The answers to multiplicative inverses modulo a composite can be found without using the extended Euclidean algorithm if we know the factorization of the composite: Example 9.17
9. 9-2  PRIMALITY TESTING Finding an algorithm to correctly and efficiently test a very large integer and output a prime or a composite has always been a challenge in number theory, and consequently in cryptography. However, recent developments look very promising. Topics discussed in this section: 9.2.1 Deterministic Algorithms 9.2.2 Probabilistic Algorithms 9.2.3 Recommended Primality Test
9. 9.2.2  Continued Miller-Rabin Test Figure 9.2  Idea behind Fermat primality test The Miller-Rabin test needs from step  0 to step  k  − 1. Note
9. 9.2.2  Continued
9. 9.2.2   Continued Does the number 561 pass the Miller-Rabin test? Example 9.25 Solution Using base 2, let 561 − 1 = 35 × 2 4 , which means  m  = 35,  k  = 4, and  a  = 2.
9. 9.2.2   Continued We already know that 27 is not a prime. Let us apply the Miller-Rabin test. Example 9.26 Solution With base 2, let 27 − 1 = 13 × 2 1 , which means that  m  = 13,  k  = 1, and  a  = 2. In this case, because  k  − 1 = 0, we should do only the initialization step: T = 2 13  mod 27 = 11 mod 27. However, because the algorithm never enters the loop, it returns a composite.
9. 9.2.2   Continued We know that 61 is a prime, let us see if it passes the Miller-Rabin test. Example 9.27 Solution We use base 2.
9. 9-4  CHINESE REMAINDER THEOREM The Chinese remainder theorem (CRT) is used to solve a set of congruent equations with one variable but different moduli, which are relatively prime, as shown below:
9. 9-4  Continued The following is an example of a set of equations with different moduli: Example 9.35 The solution to this set of equations is given in the next section; for the moment, note that the answer to this set of equations is x = 23. This value satisfies all equations: 23 ≡ 2 (mod 3), 23 ≡ 3 (mod 5), and 23 ≡ 2 (mod 7).
9. 9-4  Continued Solution To Chinese Remainder Theorem 1. Find M = m 1  × m 2  × … × m k . This is the common modulus. 2. Find M 1  = M/m 1 , M 2  = M/m 2 , …, M k  = M/m k . 3. Find the multiplicative inverse of M 1 , M 2 , …, M k  using the   corresponding moduli (m 1 , m 2 , …, m k ). Call the inverses   M 1 −1 , M 2 −1 , …, M k   −1 . 4. The solution to the simultaneous equations is
9. 9-4  Continued Find the solution to the simultaneous equations: Example 9.36 Solution We follow the four steps. 1. M = 3 × 5 × 7 = 105 2. M 1  = 105 / 3 = 35, M 2  = 105 / 5 = 21, M 3  = 105 / 7 = 15 3. The inverses are M 1 −1  = 2, M 2 −1  = 1, M 3   −1  = 1 4. x = (2 × 35 × 2 + 3 × 21 × 1 + 2 × 15 × 1) mod 105 = 23 mod 105
9. 9-4  Continued Find an integer that has a remainder of 3 when divided by 7 and 13, but is divisible by 12. Example 9.37 Solution This is a CRT problem. We can form three equations and solve them to find the value of x. If we follow the four steps, we find x = 276. We can check that  276 = 3 mod 7, 276 = 3 mod 13 and 276 is divisible by 12 (the quotient is 23 and the remainder is zero).
9. 9-4  Continued Assume we need to calculate  z  =  x  +  y  where  x  = 123 and  y  = 334, but our system accepts only numbers less than 100. These numbers can be represented as follows: Example 9.38 Adding each congruence in  x  with the corresponding congruence in  y  gives Now three equations can be solved using the Chinese remainder theorem to find z. One of the acceptable answers is  z  = 457.

Mais conteúdo relacionado

Mais procurados

Coin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic ProgrammingCoin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic ProgrammingSyeda Khadizatul maria
 
Mathematical Induction
Mathematical InductionMathematical Induction
Mathematical InductionEdelyn Cagas
 
Security of RSA and Integer Factorization
Security of RSA and Integer FactorizationSecurity of RSA and Integer Factorization
Security of RSA and Integer FactorizationDharmalingam Ganesan
 
Fermat and euler theorem
Fermat and euler theoremFermat and euler theorem
Fermat and euler theoremJanani S
 
Sum of subsets problem by backtracking 
Sum of subsets problem by backtracking Sum of subsets problem by backtracking 
Sum of subsets problem by backtracking Hasanain Alshadoodee
 
Predicates and quantifiers presentation topics
Predicates  and quantifiers  presentation topicsPredicates  and quantifiers  presentation topics
Predicates and quantifiers presentation topicsR.h. Himel
 
Cryptography using rsa cryptosystem
Cryptography using rsa cryptosystemCryptography using rsa cryptosystem
Cryptography using rsa cryptosystemSamdish Arora
 
Class 14 3D HermiteInterpolation.pptx
Class 14 3D HermiteInterpolation.pptxClass 14 3D HermiteInterpolation.pptx
Class 14 3D HermiteInterpolation.pptxMdSiddique20
 
Travelling SalesMan Problem(TSP)
Travelling SalesMan Problem(TSP)Travelling SalesMan Problem(TSP)
Travelling SalesMan Problem(TSP)Akshay Kamble
 
Presentation about RSA
Presentation about RSAPresentation about RSA
Presentation about RSASrilal Buddika
 
Counting, mathematical induction and discrete probability
Counting, mathematical induction and discrete probabilityCounting, mathematical induction and discrete probability
Counting, mathematical induction and discrete probabilitySURBHI SAROHA
 
5.4 mathematical induction
5.4 mathematical induction5.4 mathematical induction
5.4 mathematical inductionmath260
 
Predicates and Quantifiers
Predicates and QuantifiersPredicates and Quantifiers
Predicates and Quantifiersblaircomp2003
 

Mais procurados (20)

Coin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic ProgrammingCoin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic Programming
 
vedic mathematics
vedic mathematics vedic mathematics
vedic mathematics
 
Mathematical Induction
Mathematical InductionMathematical Induction
Mathematical Induction
 
Bisection method
Bisection methodBisection method
Bisection method
 
Security of RSA and Integer Factorization
Security of RSA and Integer FactorizationSecurity of RSA and Integer Factorization
Security of RSA and Integer Factorization
 
Fermat and euler theorem
Fermat and euler theoremFermat and euler theorem
Fermat and euler theorem
 
Sum of subsets problem by backtracking 
Sum of subsets problem by backtracking Sum of subsets problem by backtracking 
Sum of subsets problem by backtracking 
 
Predicates and quantifiers presentation topics
Predicates  and quantifiers  presentation topicsPredicates  and quantifiers  presentation topics
Predicates and quantifiers presentation topics
 
Cryptography using rsa cryptosystem
Cryptography using rsa cryptosystemCryptography using rsa cryptosystem
Cryptography using rsa cryptosystem
 
Number theory
Number theoryNumber theory
Number theory
 
Maxflow
MaxflowMaxflow
Maxflow
 
Class 14 3D HermiteInterpolation.pptx
Class 14 3D HermiteInterpolation.pptxClass 14 3D HermiteInterpolation.pptx
Class 14 3D HermiteInterpolation.pptx
 
Travelling SalesMan Problem(TSP)
Travelling SalesMan Problem(TSP)Travelling SalesMan Problem(TSP)
Travelling SalesMan Problem(TSP)
 
Presentation about RSA
Presentation about RSAPresentation about RSA
Presentation about RSA
 
Counting, mathematical induction and discrete probability
Counting, mathematical induction and discrete probabilityCounting, mathematical induction and discrete probability
Counting, mathematical induction and discrete probability
 
Shortest path algorithms
Shortest path algorithmsShortest path algorithms
Shortest path algorithms
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
5.4 mathematical induction
5.4 mathematical induction5.4 mathematical induction
5.4 mathematical induction
 
Predicates and Quantifiers
Predicates and QuantifiersPredicates and Quantifiers
Predicates and Quantifiers
 

Destaque

Public Key Algorithms
Public Key AlgorithmsPublic Key Algorithms
Public Key AlgorithmsBit Hacker
 
Complex numbers, neeton's method and fractals
Complex numbers, neeton's method and fractalsComplex numbers, neeton's method and fractals
Complex numbers, neeton's method and fractalsannalf
 
Fractal Geometry Course
Fractal Geometry CourseFractal Geometry Course
Fractal Geometry CourseMartin Turner
 
Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve CryptographyKelly Bresnahan
 
CRYPTOGRAPHY AND NETWORK SECURITY
CRYPTOGRAPHY AND NETWORK SECURITYCRYPTOGRAPHY AND NETWORK SECURITY
CRYPTOGRAPHY AND NETWORK SECURITYKathirvel Ayyaswamy
 
Solid modeling
Solid modelingSolid modeling
Solid modelingKRvEsL
 
Solid modelling cg
Solid modelling cgSolid modelling cg
Solid modelling cgNareek
 

Destaque (11)

Public Key Algorithms
Public Key AlgorithmsPublic Key Algorithms
Public Key Algorithms
 
Complex numbers, neeton's method and fractals
Complex numbers, neeton's method and fractalsComplex numbers, neeton's method and fractals
Complex numbers, neeton's method and fractals
 
fractals
fractalsfractals
fractals
 
Fractal Geometry Course
Fractal Geometry CourseFractal Geometry Course
Fractal Geometry Course
 
Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve Cryptography
 
Fractal
FractalFractal
Fractal
 
Elliptic curve cryptography
Elliptic curve cryptographyElliptic curve cryptography
Elliptic curve cryptography
 
CRYPTOGRAPHY AND NETWORK SECURITY
CRYPTOGRAPHY AND NETWORK SECURITYCRYPTOGRAPHY AND NETWORK SECURITY
CRYPTOGRAPHY AND NETWORK SECURITY
 
Solid modeling
Solid modelingSolid modeling
Solid modeling
 
Solid modelling cg
Solid modelling cgSolid modelling cg
Solid modelling cg
 
Fractals
FractalsFractals
Fractals
 

Semelhante a Prime

ch08 modified.pptmodified.pptmodified.ppt
ch08 modified.pptmodified.pptmodified.pptch08 modified.pptmodified.pptmodified.ppt
ch08 modified.pptmodified.pptmodified.ppttahirnaquash2
 
Geometry unit 7.1
Geometry unit 7.1Geometry unit 7.1
Geometry unit 7.1Mark Ryder
 
Onlinetest360.com quantitative aptitude PDF
Onlinetest360.com quantitative aptitude PDFOnlinetest360.com quantitative aptitude PDF
Onlinetest360.com quantitative aptitude PDFonlinetest
 
7.3 Solving Multi Step Frac Deci
7.3 Solving Multi Step Frac Deci7.3 Solving Multi Step Frac Deci
7.3 Solving Multi Step Frac DeciJessca Lundin
 
modul pembelajaran 4
modul pembelajaran 4modul pembelajaran 4
modul pembelajaran 4Ajrina Pia
 
MODULE_05-Matrix Decomposition.pptx
MODULE_05-Matrix Decomposition.pptxMODULE_05-Matrix Decomposition.pptx
MODULE_05-Matrix Decomposition.pptxAlokSingh205089
 
A higher problem solving strategy
A higher problem solving strategyA higher problem solving strategy
A higher problem solving strategyAan Hendroanto
 
C language numanal
C language numanalC language numanal
C language numanalaluavi
 
A study on number theory and its applications
A study on number theory and its applicationsA study on number theory and its applications
A study on number theory and its applicationsItishree Dash
 
AptitudeTestBook www.mechengg.net.pdf
AptitudeTestBook www.mechengg.net.pdfAptitudeTestBook www.mechengg.net.pdf
AptitudeTestBook www.mechengg.net.pdfHitendraThakur4
 
Maths Revision Notes - IGCSE
Maths Revision Notes - IGCSEMaths Revision Notes - IGCSE
Maths Revision Notes - IGCSERahul Jose
 

Semelhante a Prime (20)

ch08 modified.pptmodified.pptmodified.ppt
ch08 modified.pptmodified.pptmodified.pptch08 modified.pptmodified.pptmodified.ppt
ch08 modified.pptmodified.pptmodified.ppt
 
Ch08
Ch08Ch08
Ch08
 
Maths tricks -1
Maths tricks -1Maths tricks -1
Maths tricks -1
 
Rsa example
Rsa exampleRsa example
Rsa example
 
Geometry unit 7.1
Geometry unit 7.1Geometry unit 7.1
Geometry unit 7.1
 
Onlinetest360.com quantitative aptitude PDF
Onlinetest360.com quantitative aptitude PDFOnlinetest360.com quantitative aptitude PDF
Onlinetest360.com quantitative aptitude PDF
 
7.3 Solving Multi Step Frac Deci
7.3 Solving Multi Step Frac Deci7.3 Solving Multi Step Frac Deci
7.3 Solving Multi Step Frac Deci
 
Ch08
Ch08Ch08
Ch08
 
Daa chapter 3
Daa chapter 3Daa chapter 3
Daa chapter 3
 
modul pembelajaran 4
modul pembelajaran 4modul pembelajaran 4
modul pembelajaran 4
 
MODULE_05-Matrix Decomposition.pptx
MODULE_05-Matrix Decomposition.pptxMODULE_05-Matrix Decomposition.pptx
MODULE_05-Matrix Decomposition.pptx
 
A higher problem solving strategy
A higher problem solving strategyA higher problem solving strategy
A higher problem solving strategy
 
C language numanal
C language numanalC language numanal
C language numanal
 
Ma3bfet par 10.6 5 aug 2014
Ma3bfet par 10.6 5 aug 2014Ma3bfet par 10.6 5 aug 2014
Ma3bfet par 10.6 5 aug 2014
 
PEA 305.pdf
PEA 305.pdfPEA 305.pdf
PEA 305.pdf
 
5 3 solving trig eqns
5 3 solving trig eqns5 3 solving trig eqns
5 3 solving trig eqns
 
MODULE 3.pptx
MODULE 3.pptxMODULE 3.pptx
MODULE 3.pptx
 
A study on number theory and its applications
A study on number theory and its applicationsA study on number theory and its applications
A study on number theory and its applications
 
AptitudeTestBook www.mechengg.net.pdf
AptitudeTestBook www.mechengg.net.pdfAptitudeTestBook www.mechengg.net.pdf
AptitudeTestBook www.mechengg.net.pdf
 
Maths Revision Notes - IGCSE
Maths Revision Notes - IGCSEMaths Revision Notes - IGCSE
Maths Revision Notes - IGCSE
 

Último

ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 

Último (20)

Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 

Prime

  • 1. 9. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations
  • 2. 9. 9.1.1 Definition Figure 9.1 Three groups of positive integers A prime is divisible only by itself and 1. Note
  • 3. 9. 9.1.1 Continued What is the smallest prime? Example 9.1 Solution The smallest prime is 2, which is divisible by 2 (itself) and 1. List the primes smaller than 10. Example 9.2 Solution There are four primes less than 10: 2, 3, 5, and 7. It is interesting to note that the percentage of primes in the range 1 to 10 is 40%. The percentage decreases as the range increases.
  • 4. 9. 9.1.2 Cardinality of Primes Infinite Number of Primes There is an infinite number of primes. Number of Primes Note
  • 5. 9. 9.1.2 Continued As a trivial example, assume that the only primes are in the set {2, 3, 5, 7, 11, 13, 17}. Here P = 510510 and P + 1 = 510511. However, 510511 = 19 × 97 × 277; none of these primes were in the original list. Therefore, there are three primes greater than 17. Example 9.3 Find the number of primes less than 1,000,000. Example 9.4 Solution The approximation gives the range 72,383 to 78,543. The actual number of primes is 78,498.
  • 6. 9. Given a number n, how can we determine if n is a prime? The answer is that we need to see if the number is divisible by all primes less than 9.1.3 Checking for Primeness We know that this method is inefficient, but it is a good start.
  • 7. 9. 9.1.3 Continued Is 97 a prime? Example 9.5 Is 301 a prime? Example 9.6 Solution The floor of  97 = 9. The primes less than 9 are 2, 3, 5, and 7. We need to see if 97 is divisible by any of these numbers. It is not, so 97 is a prime. Solution The floor of  301 = 17. We need to check 2, 3, 5, 7, 11, 13, and 17. The numbers 2, 3, and 5 do not divide 301, but 7 does. Therefore 301 is not a prime.
  • 8. 9. Sieve of Eratosthenes 9.1.3 Continued
  • 9. 9. Euler’s phi-function,  (n), which is sometimes called the Euler’s totient function plays a very important role in cryptography. 9.1.4 Euler’s Phi-Function
  • 10. 9. We can combine the above four rules to find the value of  (n). For example, if n can be factored as n = p 1 e 1 × p 2 e 2 × … × p k e k then we combine the third and the fourth rule to find 9.1.4 Continued The difficulty of finding  (n) depends on the difficulty of finding the factorization of n . Note
  • 11. 9. 9.1.4 Continued What is the value of  (13)? Example 9.7 Solution Because 13 is a prime,  (13) = (13 −1) = 12. What is the value of  (10)? Example 9.8 Solution We can use the third rule:  (10) =  (2) ×  (5) = 1 × 4 = 4, because 2 and 5 are primes.
  • 12. 9. 9.1.4 Continued What is the value of  (240)? Example 9.9 Solution We can write 240 = 2 4 × 3 1 × 5 1 . Then  (240) = (2 4 −2 3 ) × (3 1 − 3 0 ) × (5 1 − 5 0 ) = 64 Can we say that  (49) =  (7) ×  (7) = 6 × 6 = 36? Example 9.10 Solution No. The third rule applies when m and n are relatively prime. Here 49 = 7 2 . We need to use the fourth rule:  (49) = 7 2 − 7 1 = 42.
  • 13. 9. 9.1.4 Continued What is the number of elements in Z 14 *? Example 9.11 Solution The answer is  (14) =  (7) ×  (2) = 6 × 1 = 6. The members are 1, 3, 5, 9, 11, and 13. Interesting point: If n > 2, the value of  ( n ) is even. Note
  • 14. 9. 9.1.5 Fermat’s Little Theorem First Version a p ≡ a mod p a p − 1 ≡ 1 mod p Second Version
  • 15. 9. 9.1.5 Continued Find the result of 6 10 mod 11. Example 9.12 Solution We have 6 10 mod 11 = 1. This is the first version of Fermat’s little theorem where p = 11. Find the result of 3 12 mod 11. Example 9.13 Solution Here the exponent (12) and the modulus (11) are not the same. With substitution this can be solved using Fermat’s little theorem.
  • 16. 9. Multiplicative Inverses 9.1.5 Continued a −1 mod p = a p − 2 mod p The answers to multiplicative inverses modulo a prime can be found without using the extended Euclidean algorithm: Example 9.14
  • 17. 9. 9.1.6 Euler’s Theorem First Version a  (n) ≡ 1 (mod n) Second Version a k ×  (n) + 1 ≡ a (mod n) The second version of Euler’s theorem is used in the RSA cryptosystem in Chapter 10. Note
  • 18. 9. 9.1.5 Continued Find the result of 6 24 mod 35. Example 9.15 Solution We have 6 24 mod 35 = 6  (35) mod 35 = 1. Find the result of 20 62 mod 77. Example 9.16 Solution If we let k = 1 on the second version, we have 20 62 mod 77 = (20 mod 77) (20  (77) + 1 mod 77) mod 77 = (20)(20) mod 77 = 15.
  • 19. 9. Multiplicative Inverses Euler’s theorem can be used to find multiplicative inverses modulo a composite. 9.1.6 Continued a −1 mod n = a  (n)−1 mod n
  • 20. 9. 9.1.5 Continued The answers to multiplicative inverses modulo a composite can be found without using the extended Euclidean algorithm if we know the factorization of the composite: Example 9.17
  • 21. 9. 9-2 PRIMALITY TESTING Finding an algorithm to correctly and efficiently test a very large integer and output a prime or a composite has always been a challenge in number theory, and consequently in cryptography. However, recent developments look very promising. Topics discussed in this section: 9.2.1 Deterministic Algorithms 9.2.2 Probabilistic Algorithms 9.2.3 Recommended Primality Test
  • 22. 9. 9.2.2 Continued Miller-Rabin Test Figure 9.2 Idea behind Fermat primality test The Miller-Rabin test needs from step 0 to step k − 1. Note
  • 23. 9. 9.2.2 Continued
  • 24. 9. 9.2.2 Continued Does the number 561 pass the Miller-Rabin test? Example 9.25 Solution Using base 2, let 561 − 1 = 35 × 2 4 , which means m = 35, k = 4, and a = 2.
  • 25. 9. 9.2.2 Continued We already know that 27 is not a prime. Let us apply the Miller-Rabin test. Example 9.26 Solution With base 2, let 27 − 1 = 13 × 2 1 , which means that m = 13, k = 1, and a = 2. In this case, because k − 1 = 0, we should do only the initialization step: T = 2 13 mod 27 = 11 mod 27. However, because the algorithm never enters the loop, it returns a composite.
  • 26. 9. 9.2.2 Continued We know that 61 is a prime, let us see if it passes the Miller-Rabin test. Example 9.27 Solution We use base 2.
  • 27. 9. 9-4 CHINESE REMAINDER THEOREM The Chinese remainder theorem (CRT) is used to solve a set of congruent equations with one variable but different moduli, which are relatively prime, as shown below:
  • 28. 9. 9-4 Continued The following is an example of a set of equations with different moduli: Example 9.35 The solution to this set of equations is given in the next section; for the moment, note that the answer to this set of equations is x = 23. This value satisfies all equations: 23 ≡ 2 (mod 3), 23 ≡ 3 (mod 5), and 23 ≡ 2 (mod 7).
  • 29. 9. 9-4 Continued Solution To Chinese Remainder Theorem 1. Find M = m 1 × m 2 × … × m k . This is the common modulus. 2. Find M 1 = M/m 1 , M 2 = M/m 2 , …, M k = M/m k . 3. Find the multiplicative inverse of M 1 , M 2 , …, M k using the corresponding moduli (m 1 , m 2 , …, m k ). Call the inverses M 1 −1 , M 2 −1 , …, M k −1 . 4. The solution to the simultaneous equations is
  • 30. 9. 9-4 Continued Find the solution to the simultaneous equations: Example 9.36 Solution We follow the four steps. 1. M = 3 × 5 × 7 = 105 2. M 1 = 105 / 3 = 35, M 2 = 105 / 5 = 21, M 3 = 105 / 7 = 15 3. The inverses are M 1 −1 = 2, M 2 −1 = 1, M 3 −1 = 1 4. x = (2 × 35 × 2 + 3 × 21 × 1 + 2 × 15 × 1) mod 105 = 23 mod 105
  • 31. 9. 9-4 Continued Find an integer that has a remainder of 3 when divided by 7 and 13, but is divisible by 12. Example 9.37 Solution This is a CRT problem. We can form three equations and solve them to find the value of x. If we follow the four steps, we find x = 276. We can check that 276 = 3 mod 7, 276 = 3 mod 13 and 276 is divisible by 12 (the quotient is 23 and the remainder is zero).
  • 32. 9. 9-4 Continued Assume we need to calculate z = x + y where x = 123 and y = 334, but our system accepts only numbers less than 100. These numbers can be represented as follows: Example 9.38 Adding each congruence in x with the corresponding congruence in y gives Now three equations can be solved using the Chinese remainder theorem to find z. One of the acceptable answers is z = 457.