A brief summary of the RSA asymmetric encryption process

RAS asymmetric encryption can be described as very simple, but I still streamline it after learning. The streamlining process is also my own understanding process. I learned from the following two articles and information books. If you want to learn more, you can take a look at
articles 1 , 2, and 2
RSA asymmetric encryption (asymmetric means that different passwords are used for encryption and decryption)
The following bit encryption process can be expressed by a general formula:
ciphertext = plain text of the power of E mod N (mod is the remainder operation)

So, as long as you know E and N, anyone can perform RSA encryption, so E, N RSA encrypted key, which is the public key. Then the public key = (E, N).
The following is the decryption process, which can also be expressed using a general formula:
plaintext = ciphertext power D mod N.

That is, the remainder after dividing the ciphertext power D by N is the plaintext. Knowing D and N can proceed The ciphertext is decrypted, so the combination of D and N is the private key. Then the private key = (D, N).
How to ask for E, D, N? ? ?
The following are the steps to generate the key pair (E, D, N):
Find N and
take any two prime numbers p, q. These two numbers cannot be too small, multiply p by q to get N
N = p * q and
find L (L is the middle number of the intermediate process)
L is the least common multiple of p-1 and q-1,
L = lcm (p-1 , Q-1)
Find E
E is a number larger than 1 and smaller than L and the greatest common divisor of E and L is 1.
Find D
D is a number larger than 1 and smaller than L and E * D mod L = 1.
Complete encryption process
1. Convert the received plaintext into a specific encoding method.
2. Then divide the transcoded character string into blocks. Grouping requirements: the decimal number corresponding to each group is less than 0 (that is, 4 numbers are a group)
3. Finally, you can encrypt each group separately

Published 9 original articles · won 7 · visited 1767

Guess you like

Origin blog.csdn.net/weixin_44906810/article/details/105167013