Skip to content

Build RSA from Scratch

Implement RSA from number theory primitives: modular exponentiation, prime generation via Miller-Rabin, modular inverse via extended Euclidean, key generation, encrypt/decrypt, signatures, padding (PKCS#1, OAEP, PSS). Then learn the historical attacks. The asymmetric crypto algorithm behind TLS, PGP, SSH, and Bitcoin until 2024.

advanced12 lessons4 chapters12 graded exercisesPython

No sign-up needed for lesson 1 · certificate on completion · sign up to save progress

What you’ll have built

Chapter by chapter. Every step is a graded exercise.

  • Number Theory
  • Key Generation
  • Encrypt & Sign
  • Production
Starts in Python — solve in the language you choose in the editor, same tests either way.

Curriculum

4 chapters, 12 lessons. Each lesson is a short read, one graded exercise, and a quiz.

  1. 1Modular ExponentiationRead · exercise · quiz
  2. 2Prime GenerationRead · exercise · quiz
  3. 3Extended Euclidean & Modular InverseRead · exercise · quiz
Loading reference solution…
Build RSA from Scratch