Named after the mathematicians Ron Rivest, Adi Shamir, and Leonard Aldeman, a cryptographic algorithm which depends on the difficulty of factorizing large semiprimes and a commonly used form of encryption for Internet security.
The public key consists of natural numbers n and e, where n is a product of two distinct large primes p and q. As of 2020, most RSA keys have 21024<n<24096. The number e needs to be coprime with k = (p–1)(q–1). Then a message M in the range 0≤M<n is encrypted as C = Me (mod n). When received, the message is recovered by M = Cd (mod n), where d is the multiplicative inverse of e mod k. Knowledge of d lies only with the receiver; finding d is equivalent to factorizing n, which should not be practically possible, provided large enough primes are used.