first pass of rsa notes, though they're a bit sketchy right now
This commit is contained in:
parent
660be820fa
commit
7dde8d2248
40
312/notes/rsa.md
Normal file
40
312/notes/rsa.md
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Procedure
|
||||||
|
|
||||||
|
|
||||||
|
Example using 3 values:
|
||||||
|
|
||||||
|
* p = 3
|
||||||
|
* q = 17
|
||||||
|
* e = 15
|
||||||
|
* m = 3
|
||||||
|
|
||||||
|
There are a few components which must be calculated before we can safely determine a cipher text:
|
||||||
|
|
||||||
|
`n = p * q` : note that `p` and `q` values should be primes in this case.
|
||||||
|
|
||||||
|
`O(n) = (p - 1) * (q - 1)` is used later to verify that we have a value `d` which is the inverse of `e`. _We call this the quotient function_.
|
||||||
|
|
||||||
|
|
||||||
|
## Encryption
|
||||||
|
|
||||||
|
To produce a cipher text `C` we take `m` and raise it to the power of `e`(from earlier) then take the modulor of it by `n`:
|
||||||
|
|
||||||
|
```
|
||||||
|
C = (m^e) % n
|
||||||
|
```
|
||||||
|
|
||||||
|
`m` is the desired message to encrypt.
|
||||||
|
|
||||||
|
The public and private keys are using the above cipher text functions whose unknown parameters are passed as follows
|
||||||
|
|
||||||
|
`PublicKey(e, n)`
|
||||||
|
|
||||||
|
`PrivateKey(d, n)`
|
||||||
|
|
||||||
|
## Decryption
|
||||||
|
|
||||||
|
The reverse of this is the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
M = (c^d) % n
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user