typos
This commit is contained in:
parent
0b53cf4500
commit
57dfce6400
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue