Public-key cryptography (Diffie–Hellman, RSA)
Two-key encryption: a public key to encrypt or verify, a private key to decrypt or sign.
Edited by Alex C, EduAlx · Sources cited below
Explanation
Diffie and Hellman (1976) introduced public-key key exchange; Rivest, Shamir and Adleman (1977–78) built RSA from the difficulty of factoring large numbers. Elliptic-curve cryptography gives the same security with shorter keys. Quantum computers running Shor's algorithm would break both, leading to post-quantum standards (NIST, 2024: ML-KEM, ML-DSA).
Example
Code
p, q = 61, 53 n, phi = p*q, (p-1)*(q-1) e = 17 d = pow(e, -1, phi) # 2753 c = pow(65, e, n) # 2790 assert pow(c, d, n) == 65
How it works, step by step
- Choose two large primes p and q
- Compute n = pq and φ(n)
- Choose e coprime to φ(n); compute d = e⁻¹ mod φ(n)
- Encrypt c = m^e mod n
- Decrypt m = c^d mod n
Open the interactive page with diagrams →
People behind it
- Whitfield Diffie (b. 1944), Cryptography, USA: Co-invented public-key cryptography (1976). Turing Award 2015.
- Martin Hellman (b. 1945), Cryptography, USA: Stanford professor; co-invented Diffie–Hellman key exchange. Turing Award 2015.
- Ron Rivest (b. 1947), Cryptography, USA: MIT professor; co-invented RSA and designed MD5 and RC4. Turing Award 2002; co-author of CLRS.
- Adi Shamir (b. 1952), Cryptography, Israel: Co-invented RSA and Shamir's secret sharing; works at the Weizmann Institute. Turing Award 2002.
- Leonard Adleman (b. 1945), Computer science, USA: Co-invented RSA and founded DNA computing (1994). Turing Award 2002.
- Peter Shor
References
- W. Diffie, M. E. Hellman, IEEE Trans. Inf. Theory 1976, 22, 644–654.
- R. L. Rivest, A. Shamir, L. Adleman, Commun. ACM 1978, 21, 120–126.
Textbooks
- Introduction to Modern Cryptography, Jonathan Katz, Yehuda Lindell (CRC Press, 3rd ed. 2020). Rigorous cryptography.
Related topics
Computer security fundamentals (CIA triad)Hash functions and digital signaturesProgramming paradigmsInformation theory and entropyCompilersWorld Wide Web, HTTP and HTMLMachine learningComputer networks and the TCP/IP modelNeural networks and backpropagationRelational databases and SQL