7.1 Number theory background and classical factoring
3 min read•july 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
number theory - Purpose of Fermat's Little Theorem - Mathematics Stack Exchange View original
Is this image relevant?
number theory - Purpose of Fermat's Little Theorem - Mathematics Stack Exchange View original
Is this image relevant?
number theory - Purpose of Fermat's Little Theorem - Mathematics Stack Exchange View original
Is this image relevant?
number theory - Purpose of Fermat's Little Theorem - Mathematics Stack Exchange View original
Is this image relevant?
1 of 2
Top images from around the web for Fundamentals of number theory
number theory - Purpose of Fermat's Little Theorem - Mathematics Stack Exchange View original
Is this image relevant?
number theory - Purpose of Fermat's Little Theorem - Mathematics Stack Exchange View original
Is this image relevant?
number theory - Purpose of Fermat's Little Theorem - Mathematics Stack Exchange View original
Is this image relevant?
number theory - Purpose of Fermat's Little Theorem - Mathematics Stack Exchange View original
Is this image relevant?
1 of 2
Modular arithmetic performs arithmetic operations on integers within a fixed range or modulus (n)
relation a≡b(modn) holds if and only if n divides (a−b)
Congruence classes are sets of integers that have the same remainder when divided by n (2, 7, 12 are in the same congruence class modulo 5)
states that for coprime integers a and n, aϕ(n)≡1(modn)
ϕ(n) is , counting the number of positive integers up to n that are coprime to n (ϕ(12)=4 since 1, 5, 7, 11 are coprime to 12)
is a special case of Euler's theorem
If p is prime and a is not divisible by p, then ap−1≡1(modp) (36≡1(mod7))
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)
uses a sequence of numbers to find a factor with average time complexity O(n1/4)
finds smooth numbers to create a congruence of squares with time complexity O(e(logn)1/2(loglogn)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:
Choose two large prime numbers p and q
Compute n=pq and ϕ(n)=(p−1)(q−1)
Select public exponent e coprime to ϕ(n)
Compute private exponent d such that ed≡1(modϕ(n))
Encryption: c≡me(modn)
Decryption: m≡cd(modn)
The security of RSA relies on the difficulty of factoring large numbers
If an attacker can factor n, they can compute ϕ(n) and derive the private key d
Applications of modular arithmetic
Modular exponentiation efficiently computes abmodn using repeated squaring
Example: Compute 3100mod17 by repeatedly squaring 3 and reducing modulo 17
Solving linear congruences finds solutions to equations of the form ax≡b(modn)
Use the extended Euclidean algorithm to find the modular multiplicative inverse of a modulo n
Example: Solve 3x≡4(mod7) by finding the inverse of 3 modulo 7 and multiplying both sides
solves a system of simultaneous linear congruences
Example: Find x such that x≡2(mod3), x≡3(mod5), and x≡2(mod7) by combining the congruences using their pairwise coprime moduli