Current location - Quotes Website - Personality signature - Help me explain the principle of RSA algorithm.
Help me explain the principle of RSA algorithm.
First, find three numbers, p, q, r,

Where p and q are two different prime numbers, and r is a number that is coprime with (p- 1)(q- 1).

P, Q and R are the private keys.

Next, find m so that RM = =1mod (p-1) (q-1

This M must exist, because R and (p- 1)(q- 1) are coprime and can be obtained by division.

Calculate n = pq again.

Numbers m and n are public keys.

The encoding process is, if the data is A, treat it as a big integer, assuming A.

If a > = n, a is expressed as s carry (s

Then each number is less than n, and then segmented coding is performed.

Next, calculate b = = a m mod n, (0

B is coded data.

The decoding process is to calculate c = = b r mod pq (0

As a result, decoding is completed. It will be proved later that C and A are actually equal:)

If a third party eavesdrops, it will get several numbers: M, N (= PQ), B.

If he wants to decode, he must find a way to get R, so he must factorize N first.

The most effective way to prevent his decomposition is to find two very large prime numbers p, q,

Difficult to decompose the third party

< theorem >;

If p and q are different prime numbers, RM = =1mod (p-1) (q-1),

A is any positive integer, b = b == a^m module pq, c == b^r module pq,

Then c == a mod pq

The process of proof will use Fermat's Last Theorem, which is described as follows:

M is an arbitrary prime number and n is an arbitrary integer, then n^m == n mod m

(In other words, if n and m are coprime, then n (m- 1) = = 1 mod m)

Using some basic knowledge of group theory, we can easily prove Fermat's last theorem.

& lt prove >

Because RM = =1mod (p-1) (q-1), RM = k (p-1) (q-1)+1,where k is an integer.

Because it keeps modular multiplication.

(x == y mod z and u = = v mod z => Xu == yv mod z),

So c = = b r = = (a m) r = = a (RM) = = a (k (p-1) (q-1)+1) modpq.

1. If a is not a multiple of p or q,

Then a (p-1) =1mod p (Fermat's last theorem) =>A (k (p-1) (q-1)) =1mod p.

A (q-1) =1mod q (Fermat's last theorem) =>A (k (p-1) (q-1)) =1mod q.

So both p and q can be divisible by a (k (p-1) (q-1))-1= > pq | a (k (p-1))-.

That is, a (k (p-1) (q-1)) = =1modpq.

= & gtc = = a^(k(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) =1mod q (Fermat's last theorem)

= & gta^(k(p- 1)(q- 1))= = 1 mod q

= & gtc = = a^(k(p- 1)(q- 1)+ 1)= = a mod q

= & gtq | c - a

Because p | a

= & gtc = = a^(k(p- 1)(q- 1)+ 1)= = 0 mod p

=> Translation Company

Therefore, pq | c-a =>c == a mod pq.

3. If A is a multiple of Q but not a multiple of P, the proof is the same as above.

4. if a is a multiple of p and q,

Pq | a

= & gtc = = a^(k(p- 1)(q- 1)+ 1)= = 0 mod pq

= & gtpq | c - a

= & gtc == a mod pq

S.H.I.E.L.D.

This theorem shows that when A is encoded as B and then decoded as C, a == c mod n (n = pq).

But when we encode and decode, we limit it to 0.

So this means that A equals C, so this process can really realize the function of encoding and decoding.