Loading...
Loading...
Cryptography · Axiom Academy
LESSON RSA Encryption and Decryption Learn how RSA encrypts messages using modular exponentiation and why decryption recovers the original message 1. Message Preparation: Text to Numbers Before encrypting, we must convert our message into a numerical form. This process involves: Encoding: Convert each character to its numeric value (e.g., ASCII or UTF-8) Blocking: Group the numbers into blocks smaller than the modulus n Constraint: Each message block m must satisfy: 0 ≤ m n Combined: m = 7273 (one possible blocking) 2. Encryption: Computing the Ciphertext To encrypt a message block m , we use the public key ( e , n ) and compute: c is the ciphertext (encrypted message) m is the plaintext message block e is the public exponent (commonly 65537) n is the modulus ( n = p × q , where p and q are large primes) 3. Decryption: Recovering the Original Message To decrypt the ciphertext c , the recipient uses their private key ( d , n ) and computes: m is the recovered plaintext message d is the private exponent (kept secret!) n is the same modulus used in encryption 4. Why Decryption Works: Euler's Theorem The magic of RSA lies in the mathematical relationship between e and d . When we encrypt and then decrypt, we compute: The exponents e and d are chosen such that: Where φ( n ) = ( p -1)( q -1) is Euler's totient function. By Euler's theorem, this guarantees: Let's walk through a full RSA encryption and decryption with actual numbers: Compute modulus: n = p × q = 11 × 13 = 143
This is the written version of the interactive lesson above. See the full Cryptography course.