Neural Sync Active
Number Theory and RSA
Registry Synced
Number Theory and RSA
253 words
1 min read
Reading compass
Now · 8.1 Modular Arithmetic Review
Number Theory and RSA
8.1 Modular Arithmetic Review
a≡b(modn) means n∣(a−b).
Key properties:
- a≡b(modn) and c≡d(modn)⟹ac≡bd(modn)
- a≡b(modn)⟹ak≡bk(modn)
8.2 Euler's Theorem
ϕ(n)=np∣n∏(1−p1)For p prime: ϕ(p)=p−1. For n=pq (product of two primes): ϕ(n)=(p−1)(q−1).
Euler's Theorem: If gcd(a,n)=1, then aϕ(n)≡1(modn).
8.3 RSA Algorithm
Key generation:
- Choose large primes p,q
- Compute n=pq, ϕ(n)=(p−1)(q−1)
- Choose e with gcd(e,ϕ(n))=1
- Compute d=e−1(modϕ(n))
- Public key: (n,e), Private key: (n,d) Encryption: c=me(modn) Decryption: m=cd(modn) Why it works: cd≡(me)d≡med≡m1+kϕ(n)≡m⋅(mϕ(n))k≡m(modn)
✅ Practice Questions
Q1: For p=5,q=11, find n, ϕ(n), and choose e.
Solutionn=5×11=55, ϕ(55)=4×10=40. Choose e=3 (coprime with 40). d=3−1(mod40)=27 since 3×27=81≡1(mod40). Q2: Encrypt m=7 using the above keys. Solutionc=73(mod55)=343(mod55)=343−6×55=343−330=13. Join Discord PreviousGraph AlgorithmsNextBoolean Algebra