It is the first algorithm that can be used for both data encryption and digital signature. It is easy to understand and operate, and is also popular. The algorithm is named by the inventor Ron Rivest, Adi Shamir, and Leonard Adleman. However, the security of RSA has never been proved theoretically. It has experienced various attacks and has not been completely cracked yet.
I. RSA algorithm:
First, find three numbers, P, Q, R,
Where p, q are two different prime numbers, r is the number of interconnectivity with P-1) (q-1 ......
The three numbers P, Q, and R are private keys.
Next, locate m so that rM = 1 Mod (p-1) (q-1 ).....
This m must exist, because R and (p-1) (q-1) Interoperability, with the moving phase division can be obtained .....
Then, calculate n = PQ .......
M and n are public keys.
The encoding process is, if the data is A, it is considered as a large integer, assuming a <n ....
If a> = N, the table is converted into S-carry (S <= N, usually S = 2 ^ t ),
Then each digit is less than N, and the subsequent encoding is ......
Next, calculate B = a ^ m mod N, (0 <= B <n ),
B is the encoded information ......
The decoding process is to calculate c = B ^ r mod PQ (0 <= C <PQ ),
Then, after decoding, it will prove that C and A are actually equal.
If a third party eavesdroppers, it will get several numbers: M, N (= PQ), B ......
If he wants to decode it, he must find a way to get the r ......
Therefore, he must first perform prime factor decomposition on n .........
To prevent decomposition, the most effective method is to find two very large numbers P, Q,
Making it difficult for a third party to conduct factor decomposition .........
<Theorem>
If p, q is a different prime number, Rm = 1 Mod (PM) (q-1 ),
A is any positive integer, B = a ^ m mod PQ, c = B ^ r mod PQ,
C = a mod PQ
The process of proof will use the ferma's theorem, which is described as follows:
M is any prime number, n is any integer, then n ^ m = n mod m
(In other words, if n and m are mutually qualitative, then n ^ (S-1) = 1 mod m)
By using some basic group theory knowledge, we can easily prove the theory of Fei Ma's small theorem ........
<Proof>
Because Rm = 1 Mod (PM) (q-1), Rm = K (PM) (q-1) + 1, where k is an integer
Because it is preserve multiplication in modulo.
(X = y mod z and U = V mod z => Xu = YV mod z ),
Therefore, c = B ^ r = (a ^ m) ^ r = a ^ (RM) = a ^ (K (p-1) (q-1) + 1) moD PQ
1. If a is not a multiple of P or a multiple of Q,
Then a ^ (p-1 = 1 mod P (ferma's theorem) => A ^ (K (PM) (q-1) = 1 mod p
A ^ (q-1) = 1 mod q (ferma's theorem) => A ^ (p-1) (q-1) = 1 mod q
So P, Q can divide all a ^ (K (PM) (q-1)-1 => PQ | a ^ (K (PM) (q-1)-1
That is, a ^ (p-1) (q-1) = 1 mod PQ
=> C = a ^ (p-1) (q-1) + 1) = a mod PQ
2. If a is a multiple of P, but not a multiple of Q,
Then a ^ (q-1) = 1 mod q (ferma's theorem)
=> A ^ (p-1) (q-1) = 1 mod q
=> C = a ^ (p-1) (q-1) + 1) = a mod q
=> Q | C-
Because p |
=> C = a ^ (p-1) (q-1) + 1) = 0 mod p
=> P | C-
Therefore, PQ | C-A => C = a mod PQ
3. If a is a multiple of Q, but not a multiple of P, it must be the same as above.
4. If a is a multiple of p and q At the same time,
Then PQ |
=> C = a ^ (p-1) (q-1) + 1) = 0 mod PQ
=> PQ | C-
=> C = a mod PQ
Q. e.d.
This theorem indicates that when a is encoded as B and decoded as C, A = C mod n (n = PQ )....
However, when encoding and decoding, the limit is 0 <= A <n, 0 <= C <n,
So this means that a is equal to C, so this process can indeed implement the encoding and decoding function .....