From f0c8c158b47569afbe6dd877214b0eb92bfe8413 Mon Sep 17 00:00:00 2001 From: whx Date: Tue, 22 Nov 2022 00:57:32 +0100 Subject: [PATCH] update RSA --- Cryptography/RSA.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/Cryptography/RSA.md b/Cryptography/RSA.md index f7dc103..ce224d7 100644 --- a/Cryptography/RSA.md +++ b/Cryptography/RSA.md @@ -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)