A form of asymmetric cryptography.

Full name is the Rivest, Shamir, Adelson Algorithm

It relies on modular arithmetic which, unfortunately, is really slow :((. Encryption/decryption are computation-heavy. Ok for occasional communication but too slow for extensive data transfer. It’s good for establishing initial secure connection. Hard to crack because to determine from requires computing factors of which is a hard problem


  • Choose two large primes and (1024-bits each)
  • Compute
  • Choose that has no common factors with (commonly 3)
  • Choose such that
  • Public key:
  • Private key:
  • Encrypting is then
  • Decrypting is then

Key exchange can also be performed using RSA

  • If Alice and Bob both know the other’s public key, how can they agree on a shared “session” key?
  • Alice chooses key and encrypts it with Bob’s public key and Alice’s private key
  • Bob decrypt’s the message using his private key and Alice’s public key

See also: elliptic curve cryptography