This commit is contained in:
Stefan Friese 2023-04-05 19:45:15 +02:00
parent 7bed6e2d00
commit 4daf8ceba7
1 changed files with 19 additions and 4 deletions

View File

@ -2,10 +2,21 @@
* `p * q = n` * `p * q = n`
* Coprime Phi is calculated either by [Euler Totient](https://en.wikipedia.org/wiki/Euler's_totient_function) or [greatest common divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor) via [euclidean algorithm](https://crypto.stanford.edu/pbc/notes/numbertheory/euclid.html) * Coprime Phi is calculated either by [Euler Totient](https://en.wikipedia.org/wiki/Euler's_totient_function) or [greatest common divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor) via [euclidean algorithm](https://crypto.stanford.edu/pbc/notes/numbertheory/euclid.html)
* \\(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$ \\) $$
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$
$$
```python ```python
possible_e = [] possible_e = []
for i in range (2, phi): for i in range (2, phi):
@ -13,7 +24,11 @@ for i in range (2, phi):
possible_e.append() possible_e.append()
``` ```
* Decryption, private key `d` --> \\( d * e mod $\phi$ = 1 \\) * Decryption, private key `d`
$$
d * e mod $\phi$ = 1
$$
```python ```python
possible_d = [] possible_d = []
for i in range (phi + 1, phi + foo): for i in range (phi + 1, phi + foo):