updated rsa
This commit is contained in:
parent
92728599a8
commit
d9faa96cd0
|
@ -49,6 +49,38 @@ def gcd(a, b):
|
|||
|
||||
#TODO
|
||||
|
||||
## Fermat's Little Theorem
|
||||
|
||||
If modulus $p$ is a prime and and modulus $n$ is not a prime, p defines a finite field (ring).
|
||||
$$
|
||||
n \in F_{p} \{0,1,...,p-1\}
|
||||
$$
|
||||
|
||||
The field consists of elements $n$ which have an inverse $m$ resulting in $n + m = 0$ and $n * m = 1$.
|
||||
|
||||
So , $n^p - n$ is a multiple of p then $n^p \equiv n\ mod\ p$ and therefore $ n = n^p\ mod\ p$. An example
|
||||
$$
|
||||
4 = 4^{31}\ mod\ 31
|
||||
$$
|
||||
|
||||
Further, $p$ while still a prime results in $1 = n^{p-1} mod\ p$. An example
|
||||
$$
|
||||
1 = 5^{11-1}\ mod\ 11
|
||||
$$
|
||||
|
||||
### Modular Inverse
|
||||
|
||||
Coming back to the modular inverse $n$, it can be found in the following way
|
||||
$n^{p-1} \equiv 1\ mod\ p$
|
||||
$n^{p-1} * n^{-1} \equiv n^{-1}\ mod\ p$
|
||||
$n^{p-2} * n * n^-1 \equiv n^{-1}\ mod\ p$
|
||||
$n^{p-2} * 1 \equiv n^{-1}\ mod\ p$
|
||||
$n^{p-2} \equiv n^{-1}\ mod\ p$
|
||||
|
||||
## Quadratic Residue
|
||||
|
||||
$m$ is a quadratic residue when $\pm n^2 = m\ mod\ p$ with two solutions.
|
||||
Otherwise it is a quadratic non residue.
|
||||
|
||||
## Links
|
||||
|
||||
|
|
Loading…
Reference in New Issue