501 B
501 B
RSA
TODO
generating keys:
- p := large random prime
- q := large random prime
- n := p * q
- f := (p - 1) * (q - 1) (this step may differ in other versions)
- e := 65537 (most common, other constants exist)
- d := solve for x: x * e = 1 mod f
- public key := (n,e)
- private key := d
message encryption:
- m := message encoded as a number < n
- encrypted := m^e mod n
message decryption:
- m := encrypted^d mod n
- decrypted := decode message from number m