56 lines
1000 B
Plaintext
56 lines
1000 B
Plaintext
= RSA =
|
|
|
|
RSA is an asymetric encryption algorithm based on the difficulty of factoring
|
|
large prime numbers.
|
|
|
|
== algorithm ==
|
|
|
|
1) choose some `p` and `q`
|
|
* where `p` and `q` are very large primes
|
|
* `n = p * q`
|
|
2) T = (p-1)(q-1)
|
|
* known as eulers totient
|
|
3) choose 2 values e and d
|
|
* where 1 < e < T
|
|
* where e and T are [[relative_prime]]s, or coprime
|
|
* where (e * d) mod T = 1
|
|
4) we now have our keys
|
|
* n and e are public keys
|
|
* n and d are private keys
|
|
|
|
=== encryption ===
|
|
|
|
`(plaintext value)^e mod n = ciphertext value`
|
|
|
|
=== decryption ===
|
|
|
|
`(ciphertext value)^d mod n = plaintext vlaue`
|
|
|
|
=== example ===
|
|
|
|
`p = 2; q = 7`
|
|
|
|
therefore,
|
|
|
|
`n = 14; T = 6`
|
|
|
|
Due to restrictions, choose e = 5
|
|
|
|
Then choose d from pool of canidiates satisfying `(e * d) mod T = 1`
|
|
|
|
For example then, choose 11 as d
|
|
|
|
Private key `(11,14)` and public key `(5,14)`
|
|
|
|
For example Encrypt B
|
|
|
|
`2^5 mod 14 = 4` or `D`
|
|
|
|
Decrypt value
|
|
|
|
`4^11 mod 14 = 2` or our original `B`
|
|
|
|
== Also see ==
|
|
|
|
* [[Eliptic_Curve]]
|