Current location - Education and Training Encyclopedia - Graduation thesis - The cornerstone of public key encryption algorithm: big prime number
The cornerstone of public key encryption algorithm: big prime number
Prime number, also known as prime number, is a concept we learned in decimal mathematics class: it refers to a number that cannot be divisible by other natural numbers except 1 and the number itself.

The concept of prime number is extremely simple, but the study of it is the purpose of mathematicians' life. Of course, what this paper discusses is not the study of prime numbers in mathematics, but the application of prime numbers in modern cryptography.

RSA public key encryption algorithm is a typical application of prime numbers. RSA is asymmetric encryption, and its encryption and decryption use different keys. Symmetric encryption uses the same key in the process of encryption and decryption, and more detailed readers can search by themselves.

In RSA algorithm, the most basic theorem is RSA theorem, which is described as follows:

Let's choose two numbers manually, practice RSA algorithm and see the mystery of calculation.

From the above calculation process, we use the smallest prime number, 7 and 1 1, which involves a great power operation (5 1 43) and the result is a very large number. In practical application, if p and q are prime numbers with large values, then the values of n, d and e are also large, so the intermediate result of operation is also large, and the basic data types provided in programming languages cannot be used. Here, I use the BigNumber library to calculate.

So far, the calculation of how to encrypt and decrypt with prime numbers in RSA algorithm has been completed. The above contents are all taken from the book "Training of Mathematical Thinking for Programmers". Interested students can read this book. As a programmer, it is necessary to know the basic knowledge of mathematics.