# RSA

TODO

generating keys:

1. *p := large random prime*
2. *q := large random prime*
3. *n := p * q*
4. *f := (p - 1) * (q - 1)* (this step may differ in other versions)
5. *e := 65537* (most common, other constants exist)
6. *d := solve for x: x * e = 1 mod f*
7. *public key := (n,e)*
8. *private key := d*

message encryption:

1. *m := message encoded as a number < n*
2. *encrypted := m^e mod n*

message decryption:

1. *m := encrypted^d mod n*
2. *decrypted := decode message from number m*