The application and principle of ferma's Theorem in public key encryption

Source: Internet
Author: User

As mentioned on the 35th page, the ferma's small theorem has very important applications in cryptography. I have not learned the <cryptography> course yet, but I am also interested in encryption and decryption, so I decided to find out exactly what it is. the ferma's theorem is defined in Wikipedia as follows:

If a is an integer and P is a prime number

If a is not a multiple of P, this theorem can also be written

However, I found that on page 34th, the description of the ferma small theorem is as follows:

If n is a prime number and A is any positive integer less than N, then the Npower of A is the same as the N of.

After a few small examples, I think Wikipedia's explanation is more reasonable, the "A is any positive integer smaller than N" mentioned in the SiCp file may be used to check whether a number is a prime number.

Ferma check

If allB PIf the following conditions are met:

, ThenPMust be a prime number. In fact, there is no need to detect all positive integers smaller than P, and only need to test all smallerP.

What is public key encryption?

I think about the mathematical principles of cryptography I 've read some time ago.ArticleIt describes the process of public key encryption:

1. find two large prime numbers (prime number) p and q, the bigger the better, such as 100 long, and then calculate their product N = p × Q, M = (P-1) × (Q-1)
2. Find an integer e with M, that is, M and E have no appointment except 1.
3. Find an integer d so that e x D is divided by m plus 1, that is, e x D mod m = 1
Now, the world's most advanced and commonly used cryptographic systems have been designed. e is the public key which can be used for encryption, and D is the private key for decryption. You must save it yourself. product N is public, even if the enemy knows it.
Now, we use the formula x ^ e mod n to encrypt X to obtain the password Y. When cracking the ciphertext, use the formula y ^ d mod n to obtain the original article X.

This is equivalent to sending a key (Public Key) to everyone for data encryption, but unlocking this encrypted data requires another key (Private Key ).

Certification Process

Original article X = y ^ d mod n = (x ^ e mod n) ^ d mod n. This formula is equivalent to x ^ (E * D) according to the same theorem) MOD n = X to prove the correctness of this formula.

So x ^ (E-1) = 1 (mod e ),

Set integer k to make (P-1) (Q-1) k + 1 = E * D, so x ^ (E * d) = x ^ (P-1) (Q-1) k + 1) = x * x ^ (P-1) ^ (Q-1) = x (mod P ),

Similarly, x ^ (E * d) = x (mod q), that is, x ^ (E * D)-X can be divisible by p * q,

Because n = p * q, x ^ (E * d) = x (mod N.

This encryption and decryption process is the principle of the RSA public key password.

Review

The ferma check is used to check whether a number is a prime number. Based on this basic principle, it is used to find a prime number that is larger than the given prime number. What is the use of such a prime number in cryptography? The first step in the public key encryption process has mentioned that two large prime numbers are required to construct N. Once the two prime numbers of N are cracked, the entire public key encryption system has no secrets, however, we have not found a good factor for finding a number.AlgorithmUnless you try them one by one, it takes a long time. It is said that it takes tens of thousands of years to break down a 200-bit number... therefore, it is quite difficult to crack a password constructed after the product of a prime number with more digits.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.