RSA Algorithm Explained: How to Select d, e, n, p, q, and φ (phi)

Added:

RSA Basics
Core Math
Trapdoor & Factoring
Encryption Example
Key Generation
Finding the Inverse
Algorithm Walkthrough
Second Example
Real-World Use
Conclusion

RSA Basics

0:00
Playing Section
  • 1

    Explains RSA's dual meaning: algorithm and company.

  • 2

    Highlights the breakthrough of asymmetric key encryption.

  • 3

    Introduces the core concept of public/private key pairs.

Basic modular arithmetic, including modular equivalence and the concept of a modular multiplicative inverse.
The definitions of prime numbers, prime factorization, and coprime (relatively prime) integers.
Euler's Totient Function, specifically how to calculate phi(n) for the product of two prime numbers.
The basic Euclidean Algorithm for finding the Greatest Common Divisor (GCD) of two integers.
The actual math of RSA encryption and decryption, including efficient computation techniques like the Square-and-Multiply algorithm.
The application of RSA in Digital Signatures and non-repudiation.
Common cryptographic vulnerabilities of RSA, such as the mathematical weakness of using small exponents or the necessity of padding schemes like OAEP.
Hybrid Cryptography, understanding how RSA is combined with symmetric key algorithms (like AES) in real-world protocols like TLS/SSL.
329.9K views5Klikes18:27@anthonyvance7Original Release: 2014-10-14

The RSA algorithm, invented in 1977 by MIT professors Ron Rivest, Adi Shamir, and Leonard Adleman, enables secure communication through public-key cryptography where encryption uses a public key (e, n) and decryption uses a private key d. The algorithm relies on the mathematical difficulty of prime factorization as its security foundation: while multiplying two large primes to obtain n is computationally feasible, factoring n back into its original primes is practically impossible. The key generation process involves selecting two large primes p and q, computing n = p × q, calculating Euler's totient function φ(n) = (p-1)(q-1), choosing a public exponent e that is coprime with φ(n), and finding the private exponent d using the Extended Euclidean Algorithm such that e × d ≡ 1 mod φ(n). This creates a one-way trapdoor function where encryption and decryption are inverse operations, making RSA approximately 1,000 times slower than symmetric encryption algorithms like AES, which is why it is typically used in hybrid cryptographic systems for key exchange rather than bulk data encryption.