update RSA

This commit is contained in:
Stefan Friese 2022-11-22 00:57:32 +01:00
parent d9faa96cd0
commit f0c8c158b4
1 changed files with 41 additions and 0 deletions

View File

@ -82,6 +82,47 @@ $n^{p-2} \equiv n^{-1}\ mod\ p$
$m$ is a quadratic residue when $\pm n^2 = m\ mod\ p$ with two solutions.
Otherwise it is a quadratic non residue.
So a porperty of quad res are, if Quadratic Residue $QR = 1$ and Quadratic NonResidue $QN = -1$
$$
QR * QR = QR\\
QR * QN = QN\\
QN * QN = QR\\
$$
## Legendre
$$
\frac{a}{p} =
\begin{cases}
1, & if\ a\ quadratic\ residue\ mod\ p\ and\ not\ a\ \equiv\ 0\ (mod\ p),\\
-1, & if\ a\ is\ a\ non\ residue\ mod\ p,\\
0, & if\ a\ \equiv 0\ (mod\ p)\\
\end{cases}
$$
$$
\frac{a}{p} \equiv a^{p-1/2}\ (mod\ p)\ and\ \frac{a}{p} \in \{-1,0,1\}
$$
* Legendre Symbol test via Python with
```python
pow(a,(p-1)/2,p)
```
[Finding the square root of integer a which is quadratic residue](http://mathcenter.oxford.emory.edu/site/math125/findingSquareRoots/)
* Given $p \equiv 3\ mod\ 4$ the square root is calculated through
```python
pow(a,((p+1)//4),p)
```
## Tonelli-Shanks - Modular Square Root
* Find elliptic curve co-ordinates
* Precondition: modulus is not a prime
* TBD
## Links
* [Encryption+Decryption](https://www.cs.drexel.edu/~jpopyack/Courses/CSP/Fa17/notes/10.1_Cryptography/RSA_Express_EncryptDecrypt_v2.html)