diff options
author | Holden Rohrer <holden.rohrer@gmail.com> | 2019-11-11 23:52:06 -0500 |
---|---|---|
committer | Holden Rohrer <holden.rohrer@gmail.com> | 2019-11-11 23:52:06 -0500 |
commit | fd2de4e488e01fd84d877ceabbd9f0f984d93174 (patch) | |
tree | b26aa724b07960d3675c21fbfeb36e9b17fe4374 | |
parent | db732bd93ffc688e16a0d9e0eb2e321315fd4621 (diff) |
added rsa-code
-rw-r--r-- | final/final.pdf | bin | 111456 -> 135463 bytes | |||
-rw-r--r-- | final/rsa-code.tex | 20 | ||||
-rw-r--r-- | final/rsa.tex | 2 |
3 files changed, 22 insertions, 0 deletions
diff --git a/final/final.pdf b/final/final.pdf Binary files differindex 889c90f..f77fda6 100644 --- a/final/final.pdf +++ b/final/final.pdf diff --git a/final/rsa-code.tex b/final/rsa-code.tex new file mode 100644 index 0000000..64a0a47 --- /dev/null +++ b/final/rsa-code.tex @@ -0,0 +1,20 @@ +The code for RSA encryption and decryption can be found in this folder at {\tt rsa-encrypt.py} and {\tt rsa-decrypt.py}. +{\tt rsa-encrypt} relies completely on user input, allowing the user to input a semiprime of arbitrary size (larger is more secure) and a value $e$ which must be coprime with one less both divisors of the semiprime ($p-1$ and $q-1$). +However, other than basic input and type conversion (string to list of integers to list of integers, for example), the ``heavy-lifting'' it does is very limited. +{\tt\par +def decrypt\_block(blk):\par +\hskip .25in return blk**d \% n\par +} +defines the majority of it, specifically the application of Euler's theorem. + + +Similarly, decryption relies on the basic principle of Euler's theorem to develop the decryption value $d$ (and the fact that that value can exist). +While efficiency was not absolutely necessary, it could be improved by using a speedier (Euclidean algorithm-based) decision algorithm for $d$ than simply checking all values. +This was neglected to focus on the real interesting component of RSA. +Once that value $d$ is available, the decryption can be known easily +In this case, +{\tt\par +def encrypt\_block(blk):\par +\hskip .25in return (blk ** e) \% n\par +} +defines the heavy lifting of ``undoing'' the RSA encryption, and shows how RSA shines in its simplicity---in stark contrast with its convoluted comrades. diff --git a/final/rsa.tex b/final/rsa.tex index 837a00e..9fc1bec 100644 --- a/final/rsa.tex +++ b/final/rsa.tex @@ -9,3 +9,5 @@ There are several optimizations (such as applying the Chinese Remainder Theorem) \sinclude Methodology:rsa-method +\sinclude The Code:rsa-code + |