Cryptography & Security Formula Sheet

Foundational public-key cryptography identities covering RSA modulus and Euler totient generation, Extended Euclidean modular inverses, Euler theorem proof of decryption, and fast modular exponentiation.

Core Equations & Variable Definitions

RSA Modulus & Euler Totient

n = p \cdot q, \quad \varphi(n) = (p - 1)(q - 1)

p, q: distinct secret primes; factoring n back into p and q is computationally hard.

Private Key Modular Inverse

e \cdot d \equiv 1 \pmod{\varphi(n)}, \quad \gcd(e, \varphi(n)) = 1

Solved in O(log phi(n)) time via the Extended Euclidean Algorithm.

RSA Encryption & Decryption

C \equiv M^e \pmod{n}, \quad M \equiv C^d \pmod{n}

Requires 0 <= M < n; production systems add OAEP padding before exponentiation.

Binary Square-and-Multiply Complexity

T(M^e \bmod n) = O(\log_2 e) \text{ modular multiplications}

Evaluates huge cryptographic exponents in milliseconds without computing M^e directly.

Interactive Cryptography & Security Calculators

  • RSA Public-Key Cryptography Lab: Generate RSA key pairs from primes p and q, prove private exponent d via Extended Euclidean steps, and trace binary square-and-multiply encryption.

Common Exam Questions

Why must the public exponent e be coprime to phi(n)?

A modular multiplicative inverse d satisfying e*d = 1 mod phi(n) exists if and only if gcd(e, phi(n)) = 1.

Why does textbook RSA use e = 65537 in practice?

65537 = 2^16 + 1 is prime and has only two 1-bits in binary, making public encryption and signature verification extremely fast (only 16 squarings and 1 multiply) while avoiding small-exponent attacks.

Why is raw textbook RSA never used without padding in TLS or SSH?

Textbook RSA is deterministic and multiplicatively homomorphic, making it vulnerable to chosen-ciphertext attacks; real protocols wrap messages with randomized OAEP or PSS padding.