number theory
from top to down
-
RSA process
flowchart TD A("Start"):::softPink --> B("Select p and q"):::softYellow B --> C("Calculate n = p * q"):::softYellow C --> D("Calculate φ(n) = (p-1) * (q-1)"):::softYellow D --> E["Choose public key e: 1. 1 < e < φ(n) 2. gcd(e,φ(n)) = 1 3. Typically use 65537"]:::softYellow E --> F["Calculate private key d: 1. d * e ≡ 1 mod φ(n) 2. Extended Euclidean Algorithm 3. d is the multiplicative inverse of e"]:::softYellow F --> G("Keys Generated"):::softBlue G --> H("Encryption: C ≡ M^e mod n"):::softPink G --> I("Decryption: M ≡ C^d mod n"):::softBlue classDef softPink fill:#FFE6E6,stroke:#666,stroke-width:1px classDef softBlue fill:#E6E6FF,stroke:#666,stroke-width:1px classDef softYellow fill:#FFFFF0,stroke:#666,stroke-width:1px
-
basic princle for this algorithm
-
decryptable
as above
we have plaintext M, keys (d,e,n)
sending
recieve C, and decoding
that is proof:
-
modular
a mod b:= r => a = qb+r
not that a <0 could have similar way to find it
-40 mod 11= ?
q*11 +40 = r
basic properties
this improvement is quick simple, I’d like to using visualization as below.
Also, if you like a formal proof
Note that, Do not using divided into this function, a straight-forward way:
Because 3 and 6 are not coprime (互质), division does not hold in modular arithmetic. This is one of the most critical points to note when working with congruences(同余)
-
modular inverse(模逆元)
This concecption is too signicant to expression my second language. I have to finish it with my bilingual.
这个概念特别重要,我需要使用双语来完成相关的描述。
For a normal inverse like matrx inverse and The notation $$a^{-1}$$ should not be confused with the reciprocal in regular arithmetic.When we write $$a^{-1}$$, we mean the number that when multiplied by $$a$$ gives 1 in modular arithmetic
我们通常将 等价于 这种情况下,我们说d是e的乘法逆元
值得一提,我们通常直接会将这个负一次幂保留,而去理解成他的逆元(或者是他的等价式子)千万不要当到倒数去理解(这是在不用模下面的倒数)
-
Application(应用):
The main application is to enable division in modular arithmetic by converting division into multiplication:上节我们知道,模运算不支持除法等价性,这时候我们能够将其同时呈上对应的乘法逆元,就能拿使用对应的性质
$ \quad a \times b^{-1} \mod n = ((a \mod n) \times (b^{-1} \mod n)) \mod n
$ -
Existence Property(存在性):
A modular multiplicative inverse of $$a$$ modulo $$m$$ exists if and only if $$a$$ and $$m$$ are coprime.That is, if $$\gcd(a,m) = 1$$, then there exists a unique $$b$$ in $$[0,m-1]$$ such that:
换句话说,互质的两个数具有除法消去性
-
-
-
Euler’s Theorem and proof
-
Euler’s totient funtcion
conclude all the numbers which are prime to n in range(0,n).
Specially, If n is a prime number,
-
Euler’s Theorem
Proof:
since this proof represent a constructing way, I’d like to demo it a little
e.g
congruence set{1,3,5,7} for 8 ,
meanwhile a in {1,3,5,7}
try a =3
you can get {3,9,15,21} while the rest set is {3,1,7,5}
so far, you have to remeber
- RSA algorithm in math is actually a mod inverse computing anti decryption
- set, group, class begin
-
-