diff --git a/312/notes/rsa.md b/312/notes/rsa.md new file mode 100644 index 0000000..fecb105 --- /dev/null +++ b/312/notes/rsa.md @@ -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 +```