SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Downloaden Sie, um offline zu lesen
Cryptography and Data
Security

   Number Theory (2 of 2)




   (presented by Aleksandr Yampolskiy)
Review

n   Integers mod n: Zn = {0, 1, …, n-1}
n   Multiplicative integers mod n:
    Zn* = {x2 Zn : all x relatively prime to n}
n   Example:
    ¡   Z6 = {0, 1, 2, 3, 4, 5}
    ¡   Z6* = {1, 5}
Review (cont.)
n   Euler’s totient function: φ (n) = |Zn*|
    ¡ φ(mn) = φ(m)¢ φ(n)

    ¡ φ(pk) = pk – pk-1

n   In general, φ(∏i piei) = ∏i(piei – piei-1)
n   Q: How many integers in [0, 12] are relatively
    prime to 12?
    A: Four. They are {1, 5, 7, 11}.
        φ(12) = φ(22¢3) = (22 – 21)(31 – 30) = 4.
Euler’s Theorem
n   Recall: if G is a finite group, 8 x2 G x|G| = e
n   Euler’s Theorem: xφ(n) ´ 1 mod n, where x2
    Z n* .
    Proof: Let G = Zn*, which means |G| = |Z n* |
    = φ(n). ?
n   Fermat’s Theorem: xp-1 ´ 1 mod p, where
    x2 Zp* for some prime p.
    Proof: Set n = p and apply Euler’s
    Theorem. ?
Euler’s Theorem (cont.)
n   Example 1:
    ¡ Let p = 7 so that Zp* = {1, 2, 3, 4, 5, 6}.
    ¡ Then, 26 ´ 36 ´ 46 ´ 56 ´ 66 ´ 1 mod 7
n   Example 2:
    ¡ xa ´ xa mod φ(n) mod n, where x2 Zn*
    ¡ For RSA, e2 Zφ(n)* and ed ´ 1 mod φ(n) so
      (xe)d = xed = xed mod φ(n) = x mod n.
Greatest Common Divisor

n   Greatest Common Divisor GCD(a, b) is the
    largest number that divides both a and b
n   GCD(a, b) = max {k2 Z : k|a Æ k|b}
    ¡   Example: GCD(60, 24) = 12
n   If a and b share no common factors, they
    are called relatively prime.
    ¡   Example: GCD(7, 24) = 1
Euclid’s Algorithm

n   GCD(a, b) can be computed using Euclid’s
    algorithm
n   Main idea: gcd(a, b) = gcd(b, a mod b)
n   Let a > b > 0 and Φ = (1 + v5)/2. Then,
    algorithm terminates in at most
    (log b) / (log Θ) + 1 iterations.
n   Example:
    gcd(55, 22) = gcd(22, 55 mod 22) = gcd(22, 11) = 11.
while   (b != 0)
                                   {
                                       r   = a % b;
      Euclid’s Algorithm (cont.)       a
                                       b
                                           = b;
                                           = r;
                                   }

gcd(1970, 1066) = ?

1970 = 1 x 1066 + 904   gcd(1066, 904)
1066 = 1 x 904 + 162    gcd(904, 162)
904 = 5 x 162 + 94      gcd(162, 94)
162 = 1 x 94 + 68       gcd(94, 68)
94 = 1 x 68 + 26        gcd(68, 26)
68 = 2 x 26 + 16        gcd(26, 16)
26 = 1 x 16 + 10        gcd(16, 10)
16 = 1 x 10 + 6         gcd(10, 6)
10 = 1 x 6 + 4          gcd(6, 4)
6    =1x4+2             gcd(4, 2)
4    =2x2+0             gcd(2, 0)
Euclid’s Algorithm (cont.)

Thm: If d = gcd(a, b), then 9x,y2 Z such
  that ax + by = d.
Thm: On input a, n such that gcd(a, n) =
  1, we can use Euclid’s algorithm
  (extended) to compute b such that ab
  ´ 1 mod n.
Finding Inverses
¡    Suppose gcd(a, b) = 1. We can use extended Euclidean algorithm to find
     inverses.

a = q1b + r1.
b = q2r 1 + r2
r1 = q3r2 + r3
r2 = q4r3 + r4
      …

¡    In the first iteration we have a linear equation, so we can write: r1 = a –
     q1 b
¡    In the second iteration, we similarly solve: r2 = b – q2r1 = b – q2(a – q1 b) =
     (q1 q2 + 1)¢ b – q2a
¡    At each step we combine to get such an equation until we get
     1 = a·x + b·y for some x, y
     n    a-1 = x mod b
     n    b-1 = y mod a
Polynomials over fields
n   Let f(x)= an·xn + an-1·xn-1 + … + a1·x + a0 be
    a polynomial of degree n in one variable x
    over a field F (namely, an, an-1,…, a0 ∈ F).
n   Polynomials over F, denoted as F[x]
n   Theorem: The equation f(x)=0 has at most
    n solutions in F.
n   However, the theorem does not hold over
    rings with identity.
    ¡   E.g., in Z24 the equation 6·x = 0 has six
        solutions (0,4,8,12,16,20).
Polynomials over fields (cont.)

n   We’ll be dealing with polynomials
    whose coefficients are in Zp
    (especially, p = 2).
n   Consider, f(x) = x3 + x2 and g(x) = x2 +
    x + 1 with coefficients in Z2:
    ¡   f(x) + g(x) = x3 + x + 1
    ¡   f(x) x g(x) = x5 + x2
Polynomials over fields (cont.)
n   Let f(x)= ∑i=0n ai xi and g(x)= ∑j=0m bjxj be two
    polynomials over F such that m · n
n   Theorem: There is a unique polynomial r(x)
    of degree less than m over F such that f(x) =
    h(x)g(x) + r(x).
n   r(x) is called the remainder of f(x) modulo
    g(x).
n   if f(x) has no divisors other than itself and 1
    say it is irreducible (or prime) polynomial
Finite fields

n   Finite fields play a key role in
    cryptography
n   Def: A field (F, +, ?) is finite if |F| < 1.
n   Theorem (Galois): For every prime power
    pk (k=1,2,…) there is a unique finite field
    containing pk elements. These fields are
    denoted by GF(p k). There are no finite
    fields with other cardinalities.
Finite fields (cont.)
                                 GF(4)
n   Example: To find a              (·)   0    1    a    a2
    field of size 4, we try to      0     0    0    0    0
    find an irreducible             1     0    1    a    a2
    polynomial of degree            a     0    a    a2   1
    2.                              a2    0    a2   1    a
n   a 2 + a + 1 = 0.             GF(4)
                                    (+)   0    1    a    a2
n   Note: Our calculations
                                    0     0    1    a    a2
    are over Z2 so a+b = a
                                    1     1    0    a2   a
    – b.
                                    a     a    a2   0    1
                                    a2    a2   a    1    0

Weitere ähnliche Inhalte

Was ist angesagt?

Bch and reed solomon codes generation in frequency domain
Bch and reed solomon codes generation in frequency domainBch and reed solomon codes generation in frequency domain
Bch and reed solomon codes generation in frequency domainMadhumita Tamhane
 
Engr 213 midterm 1a sol 2009
Engr 213 midterm 1a sol 2009Engr 213 midterm 1a sol 2009
Engr 213 midterm 1a sol 2009akabaka12
 
Linear cong slide 2
Linear cong slide 2Linear cong slide 2
Linear cong slide 2Vi Aspe
 
Error control coding bch, reed-solomon etc..
Error control coding   bch, reed-solomon etc..Error control coding   bch, reed-solomon etc..
Error control coding bch, reed-solomon etc..Madhumita Tamhane
 
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
 
Solving Linear Equations Over p-Adic Integers
Solving Linear Equations Over p-Adic IntegersSolving Linear Equations Over p-Adic Integers
Solving Linear Equations Over p-Adic IntegersJoseph Molina
 
CMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of FunctionsCMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of Functionsallyn joy calcaben
 
Elliptical curve cryptography
Elliptical curve cryptographyElliptical curve cryptography
Elliptical curve cryptographyBarani Tharan
 

Was ist angesagt? (19)

Report in math 830
Report in math 830Report in math 830
Report in math 830
 
Ch04
Ch04Ch04
Ch04
 
Eulers totient
Eulers totientEulers totient
Eulers totient
 
Euler phi
Euler phiEuler phi
Euler phi
 
Chap4
Chap4Chap4
Chap4
 
Prime
PrimePrime
Prime
 
Bch and reed solomon codes generation in frequency domain
Bch and reed solomon codes generation in frequency domainBch and reed solomon codes generation in frequency domain
Bch and reed solomon codes generation in frequency domain
 
Engr 213 midterm 1a sol 2009
Engr 213 midterm 1a sol 2009Engr 213 midterm 1a sol 2009
Engr 213 midterm 1a sol 2009
 
Linear cong slide 2
Linear cong slide 2Linear cong slide 2
Linear cong slide 2
 
Error control coding bch, reed-solomon etc..
Error control coding   bch, reed-solomon etc..Error control coding   bch, reed-solomon etc..
Error control coding bch, reed-solomon etc..
 
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
 
Unit 3
Unit 3Unit 3
Unit 3
 
Sect2 1
Sect2 1Sect2 1
Sect2 1
 
Complex numbers
Complex numbersComplex numbers
Complex numbers
 
Understanding Reed-Solomon code
Understanding Reed-Solomon codeUnderstanding Reed-Solomon code
Understanding Reed-Solomon code
 
Solving Linear Equations Over p-Adic Integers
Solving Linear Equations Over p-Adic IntegersSolving Linear Equations Over p-Adic Integers
Solving Linear Equations Over p-Adic Integers
 
CMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of FunctionsCMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of Functions
 
IntrRSCode
IntrRSCodeIntrRSCode
IntrRSCode
 
Elliptical curve cryptography
Elliptical curve cryptographyElliptical curve cryptography
Elliptical curve cryptography
 

Andere mochten auch

Number Theory In Cryptography
Number Theory In CryptographyNumber Theory In Cryptography
Number Theory In CryptographyAadya Vatsa
 
Number Theory In Cryptography
Number Theory In CryptographyNumber Theory In Cryptography
Number Theory In CryptographyAbhishek Nand
 
History of Number Theory
History of Number TheoryHistory of Number Theory
History of Number TheoryVolkan Nazife
 
Public key Cryptography & RSA
Public key Cryptography & RSAPublic key Cryptography & RSA
Public key Cryptography & RSAAmit Debnath
 
Network Security and Cryptography
Network Security and CryptographyNetwork Security and Cryptography
Network Security and CryptographyAdam Reagan
 

Andere mochten auch (11)

Number Theory In Cryptography
Number Theory In CryptographyNumber Theory In Cryptography
Number Theory In Cryptography
 
Number Theory In Cryptography
Number Theory In CryptographyNumber Theory In Cryptography
Number Theory In Cryptography
 
RSA ALGORITHM
RSA ALGORITHMRSA ALGORITHM
RSA ALGORITHM
 
History of Number Theory
History of Number TheoryHistory of Number Theory
History of Number Theory
 
The Number Theory
The Number TheoryThe Number Theory
The Number Theory
 
Public key Cryptography & RSA
Public key Cryptography & RSAPublic key Cryptography & RSA
Public key Cryptography & RSA
 
RSA algorithm
RSA algorithmRSA algorithm
RSA algorithm
 
Rsa Algorithm
Rsa AlgorithmRsa Algorithm
Rsa Algorithm
 
RSA ALGORITHM
RSA ALGORITHMRSA ALGORITHM
RSA ALGORITHM
 
Cryptography.ppt
Cryptography.pptCryptography.ppt
Cryptography.ppt
 
Network Security and Cryptography
Network Security and CryptographyNetwork Security and Cryptography
Network Security and Cryptography
 

Ähnlich wie Number theory lecture (part 2)

Cryptography and Network Security chapter 4.ppt
Cryptography and Network Security chapter 4.pptCryptography and Network Security chapter 4.ppt
Cryptography and Network Security chapter 4.pptthe9amit
 
Group theory notes
Group theory notesGroup theory notes
Group theory notesmkumaresan
 
functions limits and continuity
functions limits and continuityfunctions limits and continuity
functions limits and continuityPume Ananda
 
555_Spring12_topic06.ppt
555_Spring12_topic06.ppt555_Spring12_topic06.ppt
555_Spring12_topic06.pptSnehSinha6
 
Quantitative norm convergence of some ergodic averages
Quantitative norm convergence of some ergodic averagesQuantitative norm convergence of some ergodic averages
Quantitative norm convergence of some ergodic averagesVjekoslavKovac1
 
Last+minute+revision(+Final)+(1) (1).pptx
Last+minute+revision(+Final)+(1) (1).pptxLast+minute+revision(+Final)+(1) (1).pptx
Last+minute+revision(+Final)+(1) (1).pptxAryanMishra860130
 
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton Tensor
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton TensorDual Gravitons in AdS4/CFT3 and the Holographic Cotton Tensor
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton TensorSebastian De Haro
 
Number theoretic-rsa-chailos-new
Number theoretic-rsa-chailos-newNumber theoretic-rsa-chailos-new
Number theoretic-rsa-chailos-newChristos Loizos
 
Research Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and ScienceResearch Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and Scienceinventy
 
A Szemeredi-type theorem for subsets of the unit cube
A Szemeredi-type theorem for subsets of the unit cubeA Szemeredi-type theorem for subsets of the unit cube
A Szemeredi-type theorem for subsets of the unit cubeVjekoslavKovac1
 
Reflect tsukuba524
Reflect tsukuba524Reflect tsukuba524
Reflect tsukuba524kazuhase2011
 
Rational points on elliptic curves
Rational points on elliptic curvesRational points on elliptic curves
Rational points on elliptic curvesmmasdeu
 

Ähnlich wie Number theory lecture (part 2) (20)

Cryptography and Network Security chapter 4.ppt
Cryptography and Network Security chapter 4.pptCryptography and Network Security chapter 4.ppt
Cryptography and Network Security chapter 4.ppt
 
Functions limits and continuity
Functions limits and continuityFunctions limits and continuity
Functions limits and continuity
 
Group theory notes
Group theory notesGroup theory notes
Group theory notes
 
functions limits and continuity
functions limits and continuityfunctions limits and continuity
functions limits and continuity
 
CH04.ppt
CH04.pptCH04.ppt
CH04.ppt
 
555_Spring12_topic06.ppt
555_Spring12_topic06.ppt555_Spring12_topic06.ppt
555_Spring12_topic06.ppt
 
Quantitative norm convergence of some ergodic averages
Quantitative norm convergence of some ergodic averagesQuantitative norm convergence of some ergodic averages
Quantitative norm convergence of some ergodic averages
 
Last+minute+revision(+Final)+(1) (1).pptx
Last+minute+revision(+Final)+(1) (1).pptxLast+minute+revision(+Final)+(1) (1).pptx
Last+minute+revision(+Final)+(1) (1).pptx
 
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton Tensor
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton TensorDual Gravitons in AdS4/CFT3 and the Holographic Cotton Tensor
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton Tensor
 
Maths04
Maths04Maths04
Maths04
 
Imc2016 day2-solutions
Imc2016 day2-solutionsImc2016 day2-solutions
Imc2016 day2-solutions
 
Number theoretic-rsa-chailos-new
Number theoretic-rsa-chailos-newNumber theoretic-rsa-chailos-new
Number theoretic-rsa-chailos-new
 
Finite fields
Finite fields Finite fields
Finite fields
 
Final
Final Final
Final
 
Research Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and ScienceResearch Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and Science
 
Imc2017 day2-solutions
Imc2017 day2-solutionsImc2017 day2-solutions
Imc2017 day2-solutions
 
Time complexity
Time complexityTime complexity
Time complexity
 
A Szemeredi-type theorem for subsets of the unit cube
A Szemeredi-type theorem for subsets of the unit cubeA Szemeredi-type theorem for subsets of the unit cube
A Szemeredi-type theorem for subsets of the unit cube
 
Reflect tsukuba524
Reflect tsukuba524Reflect tsukuba524
Reflect tsukuba524
 
Rational points on elliptic curves
Rational points on elliptic curvesRational points on elliptic curves
Rational points on elliptic curves
 

Mehr von Aleksandr Yampolskiy

New York REDIS Meetup Welcome Session
New York REDIS Meetup Welcome SessionNew York REDIS Meetup Welcome Session
New York REDIS Meetup Welcome SessionAleksandr Yampolskiy
 
"Managing software development" by Peter Bell
"Managing software development" by Peter Bell"Managing software development" by Peter Bell
"Managing software development" by Peter BellAleksandr Yampolskiy
 
Recruiting Great Engineers in Six Easy Steps
Recruiting Great Engineers in Six Easy StepsRecruiting Great Engineers in Six Easy Steps
Recruiting Great Engineers in Six Easy StepsAleksandr Yampolskiy
 
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing It
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing ItYou Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing It
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing ItAleksandr Yampolskiy
 
Malware Goes to the Movies - Briefing
Malware Goes to the Movies - BriefingMalware Goes to the Movies - Briefing
Malware Goes to the Movies - BriefingAleksandr Yampolskiy
 
Eight simple rules to writing secure PHP programs
Eight simple rules to writing secure PHP programsEight simple rules to writing secure PHP programs
Eight simple rules to writing secure PHP programsAleksandr Yampolskiy
 
Social Engineering and What to do About it
Social Engineering and What to do About itSocial Engineering and What to do About it
Social Engineering and What to do About itAleksandr Yampolskiy
 
Inoculation strategies for victims of viruses
Inoculation strategies for victims of virusesInoculation strategies for victims of viruses
Inoculation strategies for victims of virusesAleksandr Yampolskiy
 
Much ado about randomness. What is really a random number?
Much ado about randomness. What is really a random number?Much ado about randomness. What is really a random number?
Much ado about randomness. What is really a random number?Aleksandr Yampolskiy
 
Threshold and Proactive Pseudo-Random Permutations
Threshold and Proactive Pseudo-Random PermutationsThreshold and Proactive Pseudo-Random Permutations
Threshold and Proactive Pseudo-Random PermutationsAleksandr Yampolskiy
 
Secure information aggregation in sensor networks
Secure information aggregation in sensor networksSecure information aggregation in sensor networks
Secure information aggregation in sensor networksAleksandr Yampolskiy
 
A verifiable random function with short proofs and keys
A verifiable random function with short proofs and keysA verifiable random function with short proofs and keys
A verifiable random function with short proofs and keysAleksandr Yampolskiy
 
Towards a theory of data entangelement
Towards a theory of data entangelementTowards a theory of data entangelement
Towards a theory of data entangelementAleksandr Yampolskiy
 
Price of anarchy is independent of network topology
Price of anarchy is independent of network topologyPrice of anarchy is independent of network topology
Price of anarchy is independent of network topologyAleksandr Yampolskiy
 
Spreading Rumors Quietly and the Subgroup Escape Problem
Spreading Rumors Quietly and the Subgroup Escape ProblemSpreading Rumors Quietly and the Subgroup Escape Problem
Spreading Rumors Quietly and the Subgroup Escape ProblemAleksandr Yampolskiy
 

Mehr von Aleksandr Yampolskiy (20)

New York REDIS Meetup Welcome Session
New York REDIS Meetup Welcome SessionNew York REDIS Meetup Welcome Session
New York REDIS Meetup Welcome Session
 
"Managing software development" by Peter Bell
"Managing software development" by Peter Bell"Managing software development" by Peter Bell
"Managing software development" by Peter Bell
 
Recruiting Great Engineers in Six Easy Steps
Recruiting Great Engineers in Six Easy StepsRecruiting Great Engineers in Six Easy Steps
Recruiting Great Engineers in Six Easy Steps
 
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing It
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing ItYou Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing It
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing It
 
Malware Goes to the Movies - Briefing
Malware Goes to the Movies - BriefingMalware Goes to the Movies - Briefing
Malware Goes to the Movies - Briefing
 
Privacy and E-Commerce
Privacy and E-CommercePrivacy and E-Commerce
Privacy and E-Commerce
 
Eight simple rules to writing secure PHP programs
Eight simple rules to writing secure PHP programsEight simple rules to writing secure PHP programs
Eight simple rules to writing secure PHP programs
 
Social media security challenges
Social media security challengesSocial media security challenges
Social media security challenges
 
Social Engineering and What to do About it
Social Engineering and What to do About itSocial Engineering and What to do About it
Social Engineering and What to do About it
 
OWASP Much ado about randomness
OWASP Much ado about randomnessOWASP Much ado about randomness
OWASP Much ado about randomness
 
Malware goes to the movies
Malware goes to the moviesMalware goes to the movies
Malware goes to the movies
 
Inoculation strategies for victims of viruses
Inoculation strategies for victims of virusesInoculation strategies for victims of viruses
Inoculation strategies for victims of viruses
 
Much ado about randomness. What is really a random number?
Much ado about randomness. What is really a random number?Much ado about randomness. What is really a random number?
Much ado about randomness. What is really a random number?
 
Threshold and Proactive Pseudo-Random Permutations
Threshold and Proactive Pseudo-Random PermutationsThreshold and Proactive Pseudo-Random Permutations
Threshold and Proactive Pseudo-Random Permutations
 
Secure information aggregation in sensor networks
Secure information aggregation in sensor networksSecure information aggregation in sensor networks
Secure information aggregation in sensor networks
 
A verifiable random function with short proofs and keys
A verifiable random function with short proofs and keysA verifiable random function with short proofs and keys
A verifiable random function with short proofs and keys
 
Towards a theory of data entangelement
Towards a theory of data entangelementTowards a theory of data entangelement
Towards a theory of data entangelement
 
Price of anarchy is independent of network topology
Price of anarchy is independent of network topologyPrice of anarchy is independent of network topology
Price of anarchy is independent of network topology
 
Business Case Studies
Business Case Studies Business Case Studies
Business Case Studies
 
Spreading Rumors Quietly and the Subgroup Escape Problem
Spreading Rumors Quietly and the Subgroup Escape ProblemSpreading Rumors Quietly and the Subgroup Escape Problem
Spreading Rumors Quietly and the Subgroup Escape Problem
 

Number theory lecture (part 2)

  • 1. Cryptography and Data Security Number Theory (2 of 2) (presented by Aleksandr Yampolskiy)
  • 2. Review n Integers mod n: Zn = {0, 1, …, n-1} n Multiplicative integers mod n: Zn* = {x2 Zn : all x relatively prime to n} n Example: ¡ Z6 = {0, 1, 2, 3, 4, 5} ¡ Z6* = {1, 5}
  • 3. Review (cont.) n Euler’s totient function: φ (n) = |Zn*| ¡ φ(mn) = φ(m)¢ φ(n) ¡ φ(pk) = pk – pk-1 n In general, φ(∏i piei) = ∏i(piei – piei-1) n Q: How many integers in [0, 12] are relatively prime to 12? A: Four. They are {1, 5, 7, 11}. φ(12) = φ(22¢3) = (22 – 21)(31 – 30) = 4.
  • 4. Euler’s Theorem n Recall: if G is a finite group, 8 x2 G x|G| = e n Euler’s Theorem: xφ(n) ´ 1 mod n, where x2 Z n* . Proof: Let G = Zn*, which means |G| = |Z n* | = φ(n). ? n Fermat’s Theorem: xp-1 ´ 1 mod p, where x2 Zp* for some prime p. Proof: Set n = p and apply Euler’s Theorem. ?
  • 5. Euler’s Theorem (cont.) n Example 1: ¡ Let p = 7 so that Zp* = {1, 2, 3, 4, 5, 6}. ¡ Then, 26 ´ 36 ´ 46 ´ 56 ´ 66 ´ 1 mod 7 n Example 2: ¡ xa ´ xa mod φ(n) mod n, where x2 Zn* ¡ For RSA, e2 Zφ(n)* and ed ´ 1 mod φ(n) so (xe)d = xed = xed mod φ(n) = x mod n.
  • 6. Greatest Common Divisor n Greatest Common Divisor GCD(a, b) is the largest number that divides both a and b n GCD(a, b) = max {k2 Z : k|a Æ k|b} ¡ Example: GCD(60, 24) = 12 n If a and b share no common factors, they are called relatively prime. ¡ Example: GCD(7, 24) = 1
  • 7. Euclid’s Algorithm n GCD(a, b) can be computed using Euclid’s algorithm n Main idea: gcd(a, b) = gcd(b, a mod b) n Let a > b > 0 and Φ = (1 + v5)/2. Then, algorithm terminates in at most (log b) / (log Θ) + 1 iterations. n Example: gcd(55, 22) = gcd(22, 55 mod 22) = gcd(22, 11) = 11.
  • 8. while (b != 0) { r = a % b; Euclid’s Algorithm (cont.) a b = b; = r; } gcd(1970, 1066) = ? 1970 = 1 x 1066 + 904 gcd(1066, 904) 1066 = 1 x 904 + 162 gcd(904, 162) 904 = 5 x 162 + 94 gcd(162, 94) 162 = 1 x 94 + 68 gcd(94, 68) 94 = 1 x 68 + 26 gcd(68, 26) 68 = 2 x 26 + 16 gcd(26, 16) 26 = 1 x 16 + 10 gcd(16, 10) 16 = 1 x 10 + 6 gcd(10, 6) 10 = 1 x 6 + 4 gcd(6, 4) 6 =1x4+2 gcd(4, 2) 4 =2x2+0 gcd(2, 0)
  • 9. Euclid’s Algorithm (cont.) Thm: If d = gcd(a, b), then 9x,y2 Z such that ax + by = d. Thm: On input a, n such that gcd(a, n) = 1, we can use Euclid’s algorithm (extended) to compute b such that ab ´ 1 mod n.
  • 10. Finding Inverses ¡ Suppose gcd(a, b) = 1. We can use extended Euclidean algorithm to find inverses. a = q1b + r1. b = q2r 1 + r2 r1 = q3r2 + r3 r2 = q4r3 + r4 … ¡ In the first iteration we have a linear equation, so we can write: r1 = a – q1 b ¡ In the second iteration, we similarly solve: r2 = b – q2r1 = b – q2(a – q1 b) = (q1 q2 + 1)¢ b – q2a ¡ At each step we combine to get such an equation until we get 1 = a·x + b·y for some x, y n a-1 = x mod b n b-1 = y mod a
  • 11. Polynomials over fields n Let f(x)= an·xn + an-1·xn-1 + … + a1·x + a0 be a polynomial of degree n in one variable x over a field F (namely, an, an-1,…, a0 ∈ F). n Polynomials over F, denoted as F[x] n Theorem: The equation f(x)=0 has at most n solutions in F. n However, the theorem does not hold over rings with identity. ¡ E.g., in Z24 the equation 6·x = 0 has six solutions (0,4,8,12,16,20).
  • 12. Polynomials over fields (cont.) n We’ll be dealing with polynomials whose coefficients are in Zp (especially, p = 2). n Consider, f(x) = x3 + x2 and g(x) = x2 + x + 1 with coefficients in Z2: ¡ f(x) + g(x) = x3 + x + 1 ¡ f(x) x g(x) = x5 + x2
  • 13. Polynomials over fields (cont.) n Let f(x)= ∑i=0n ai xi and g(x)= ∑j=0m bjxj be two polynomials over F such that m · n n Theorem: There is a unique polynomial r(x) of degree less than m over F such that f(x) = h(x)g(x) + r(x). n r(x) is called the remainder of f(x) modulo g(x). n if f(x) has no divisors other than itself and 1 say it is irreducible (or prime) polynomial
  • 14. Finite fields n Finite fields play a key role in cryptography n Def: A field (F, +, ?) is finite if |F| < 1. n Theorem (Galois): For every prime power pk (k=1,2,…) there is a unique finite field containing pk elements. These fields are denoted by GF(p k). There are no finite fields with other cardinalities.
  • 15. Finite fields (cont.) GF(4) n Example: To find a (·) 0 1 a a2 field of size 4, we try to 0 0 0 0 0 find an irreducible 1 0 1 a a2 polynomial of degree a 0 a a2 1 2. a2 0 a2 1 a n a 2 + a + 1 = 0. GF(4) (+) 0 1 a a2 n Note: Our calculations 0 0 1 a a2 are over Z2 so a+b = a 1 1 0 a2 a – b. a a a2 0 1 a2 a2 a 1 0