You have 3 free guides left 😟
Unlock your guides
You have 3 free guides left 😟
Unlock your guides

7.1 Number theory background and classical factoring

3 min readjuly 23, 2024

Number theory forms the backbone of many cryptographic systems. It deals with properties of integers, , and . These concepts are crucial for understanding how modern encryption works and why certain mathematical problems are hard to solve.

Number theory's applications in cryptography rely on the difficulty of certain mathematical operations. For instance, while multiplying large prime numbers is easy, factoring their product is computationally challenging. This asymmetry forms the basis of widely used encryption methods like RSA.

Number Theory Fundamentals

Fundamentals of number theory

Top images from around the web for Fundamentals of number theory
Top images from around the web for Fundamentals of number theory
  • Modular arithmetic performs arithmetic operations on integers within a fixed range or modulus (nn)
    • Addition: (a+b)modn=((amodn)+(bmodn))modn(a + b) \bmod n = ((a \bmod n) + (b \bmod n)) \bmod n (5 + 7 ≡ 2 (mod 10))
    • Multiplication: (a×b)modn=((amodn)×(bmodn))modn(a \times b) \bmod n = ((a \bmod n) \times (b \bmod n)) \bmod n (3 × 4 ≡ 2 (mod 10))
  • relation ab(modn)a \equiv b \pmod{n} holds if and only if nn divides (ab)(a - b)
    • Congruence classes are sets of integers that have the same remainder when divided by nn (2, 7, 12 are in the same congruence class modulo 5)
  • states that for coprime integers aa and nn, aϕ(n)1(modn)a^{\phi(n)} \equiv 1 \pmod{n}
    • ϕ(n)\phi(n) is , counting the number of positive integers up to nn that are coprime to nn (ϕ(12)=4\phi(12) = 4 since 1, 5, 7, 11 are coprime to 12)
  • is a special case of Euler's theorem
    • If pp is prime and aa is not divisible by pp, then ap11(modp)a^{p-1} \equiv 1 \pmod{p} (361(mod7)3^6 \equiv 1 \pmod{7})

Complexity of factoring algorithms

  • Factoring decomposes a composite number into its prime factors (60 = 2 × 2 × 3 × 5)
  • Classical factoring algorithms have limitations due to the believed hardness of factoring large numbers
    • divides the number by primes up to its square root with time complexity O(n)O(\sqrt{n})
    • uses a sequence of numbers to find a factor with average time complexity O(n1/4)O(n^{1/4})
    • finds smooth numbers to create a congruence of squares with time complexity O(e(logn)1/2(loglogn)1/2)O(e^{(\log n)^{1/2}(\log \log n)^{1/2}})
  • Best known classical algorithms have subexponential time complexity, which is exponential with respect to the number of digits in the input (factoring a 2048-bit number is much harder than factoring a 1024-bit number)

Factoring vs RSA cryptosystem

  • RSA cryptosystem is a public-key cryptosystem based on the difficulty of factoring large numbers
    • Key generation:
      1. Choose two large prime numbers pp and qq
      2. Compute n=pqn = pq and ϕ(n)=(p1)(q1)\phi(n) = (p-1)(q-1)
      3. Select public exponent ee coprime to ϕ(n)\phi(n)
      4. Compute private exponent dd such that ed1(modϕ(n))ed \equiv 1 \pmod{\phi(n)}
    • Encryption: cme(modn)c \equiv m^e \pmod{n}
    • Decryption: mcd(modn)m \equiv c^d \pmod{n}
  • The security of RSA relies on the difficulty of factoring large numbers
    • If an attacker can factor nn, they can compute ϕ(n)\phi(n) and derive the private key dd

Applications of modular arithmetic

  • Modular exponentiation efficiently computes abmodna^b \bmod n using repeated squaring
    • Example: Compute 3100mod173^{100} \bmod 17 by repeatedly squaring 3 and reducing modulo 17
  • Solving linear congruences finds solutions to equations of the form axb(modn)ax \equiv b \pmod{n}
    • Use the extended Euclidean algorithm to find the modular multiplicative inverse of aa modulo nn
    • Example: Solve 3x4(mod7)3x \equiv 4 \pmod{7} by finding the inverse of 3 modulo 7 and multiplying both sides
  • solves a system of simultaneous linear congruences
    • Example: Find xx such that x2(mod3)x \equiv 2 \pmod{3}, x3(mod5)x \equiv 3 \pmod{5}, and x2(mod7)x \equiv 2 \pmod{7} by combining the congruences using their pairwise coprime moduli
© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.


© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.

© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.
Glossary
Glossary