{
  "aliases": [
    "rivest-shamir-adleman"
  ],
  "backlinks": null,
  "body": "\n## Example\n\nThe RSA cryptosystem is an example of [[public-key cryptography|01E9MNJYEX]].\nTo make the keys, choose two distinct primes $p$ and $q$, and put $n = pq$ and $\\varphi(n) = (p - 1)(q - 1)$, the value of [[Euler's totient function|0VV04M41AN]].\nChoose an integer $e$ with $1 \u003c e \u003c \\varphi(n)$ and $\\gcd(e, \\varphi(n)) = 1$. Let $d$ be the [[inverse|00GXTQMY8Z]] of $e$ modulo $\\varphi(n)$.\nThe public key is $(n, e)$, and the private key is $d$.\nTo encrypt a message $m$ with $0 \\le m \u003c n$, compute $c = m^e \\bmod n$. To decrypt, compute $c^d \\bmod n$, which is equal to $m$.\nA small case: $p = 5$, $q = 11$, $n = 55$, $\\varphi(n) = 40$, $e = 3$ and $d = 27$, since $3 \\cdot 27 = 81 \\equiv 1 \\pmod{40}$.\nThe message $m = 2$ gives $c = 2^3 = 8$, and $8^{27} \\equiv 2 \\pmod{55}$.\n\n## Remarks\n\nDecryption works by [[Euler's theorem|0VC4DVE7DQ]]: $ed = 1 + k \\varphi(n)$, so $m^{ed} \\equiv m \\pmod n$ when $\\gcd(m, n) = 1$. The general case follows from the [[Chinese remainder theorem|0FNN9B4W64]].\nThe security rests on the belief that it is hard to factor $n$ when $p$ and $q$ are large.\nRon Rivest, Adi Shamir and Leonard Adleman described the system publicly in 1977.\n\n## Explanations\n\n### L1 human\n\nAnyone can raise a message to the power $e$ modulo $n$. To undo this, you need $d$, and to find $d$ you need the factors of $n$.\nMultiplying two large primes is easy, but recovering them from the product is believed to be very hard.\n",
  "commit": "545acf83a9b75c8ddc375ef8b23d2ae101a4d7e4",
  "front": {
    "aliases": [
      "rivest-shamir-adleman"
    ],
    "instance_of": [
      "01E9MNJYEX"
    ],
    "kind": "example",
    "msc": [
      "94A60"
    ],
    "name": "RSA cryptosystem",
    "same_as": {
      "wikidata": "Q181551",
      "wikipedia": "RSA cryptosystem"
    },
    "sources": [
      {
        "locator": "Key generation",
        "url": "https://en.wikipedia.org/wiki/RSA_cryptosystem"
      },
      {
        "locator": "Proof using Euler's theorem",
        "url": "https://en.wikipedia.org/wiki/RSA_cryptosystem"
      }
    ],
    "tag": "0HM584C465",
    "uses": [
      "0VC4DVE7DQ",
      "0VV04M41AN",
      "00GXTQMY8Z",
      "04DR5PM25N"
    ]
  },
  "kind": "example",
  "link": "https://math2.tamnd.com/node/0HM584C465/",
  "links": [
    {
      "field": "instance_of",
      "target": "01E9MNJYEX"
    },
    {
      "field": "uses",
      "target": "0VC4DVE7DQ"
    },
    {
      "field": "uses",
      "target": "0VV04M41AN"
    },
    {
      "field": "uses",
      "target": "00GXTQMY8Z"
    },
    {
      "field": "uses",
      "target": "04DR5PM25N"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/0HM584C465.md",
  "msc": [
    "94A60"
  ],
  "name": "RSA cryptosystem",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/0HM/0HM584C465.md",
  "status": null,
  "tag": "0HM584C465",
  "uri": "m2://0HM584C465",
  "url": "https://math2.tamnd.com/wiki/rsa-cryptosystem/",
  "writing": {
    "tag": "0HM584C465",
    "kind": "example",
    "level": "W2",
    "next": [
      {
        "what": "a person confirmed each agent-written section",
        "note": "rule P04",
        "have": 0,
        "want": 1
      }
    ]
  }
}
