From 57dfce64001012d48250ebf811b437abc45eba1b Mon Sep 17 00:00:00 2001 From: gurkenhabicht Date: Sun, 18 Feb 2024 21:52:35 +0100 Subject: [PATCH] typos --- Cryptography/RSA.md | 47 +++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/Cryptography/RSA.md b/Cryptography/RSA.md index cd01f57..e08fafc 100644 --- a/Cryptography/RSA.md +++ b/Cryptography/RSA.md @@ -12,24 +12,46 @@ common divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor) via [euclidean algorithm](https://crypto.stanford.edu/pbc/notes/numbertheory/euclid.html) -`d` is the modular inverse of e and phi +$$ +\phi(n) = (p-1)(q-1) +$$ ---- +and further $$ 1 < \phi < n $$ -There is also -$$ -\phi = (p-1) * (q-1) -$$ Encryption, public key `e` is a prime between 2 and phi $$ 2 < e < \phi $$ + +Decryption, private key `d` +$$ +d\ e\ mod\ \phi(n) \equiv 1 +$$ + +$$ +d\ e \equiv 1\ (mod\ \phi(n)) +$$ + +`d` is the modular inverse of e and phi and makes the private key. + +$$ +Cipher = msg^{d}\ mod\ \phi +$$ + +$$ +Cleartext = cipher^{e}\ mod\ \phi +$$ + +--- + +`e` and `d` may be found through the following Python snippets + ```python possible_e = [] for i in range (2, phi): @@ -37,11 +59,6 @@ for i in range (2, phi): possible_e.append() ``` -Decryption, private key `d` -$$ -d * e mod \phi = 1 -$$ - ```python possible_d = [] for i in range (phi + 1, phi + foo): @@ -49,14 +66,6 @@ for i in range (phi + 1, phi + foo): possible_d.append() ``` -$$ -Cipher = msg ** d mod \phi -$$ - -$$ -Cleartext = cipher ** e mod \phi -$$ - ## Euklid Just a short excourse: