The so-called “usually do not work hard, the exam is brothers,” the exam is approaching, the cheating monster Zhang San is pondering how to cheat in the final exam.

It is known that Zhang San’s school, and there are two special provisions for the exam:

The test paper seals before the exam, the invigilator does not know the questions, nor can you check the content of the students in the exam, so the teacher can’t know the correct answer. Care students to make a drawback, even if the students are in the paper strip, if the teacher can’t understand or decrypt the content on the note, it cannot qualitatively cheating.

Of course, this school’s teacher has a wealth of anti-cheating experience, like what to touch the idioplasses B, and touch the right ear, and escape the mental eye.

Symmetric encryption

He has always dreamed of him to become a hacker, and the day before yesterday seems to have turned a book about network information security. It refers to a cryptographic method called “symmetrical encryption”.

This is a method using the same key for encryption and decryption.

After the data sender is handled by a special algorithm, the data sender will turn into a very complex encrypted ciphertext, then send to the data receiver, the data receiver reuse the encryption key and the inverse algorithm of the same algorithm, Cipher text is decrypted and recover secret text to clear text.

Zhang San thought:

Let the buddies, who have achieved good learning, write the correct answer on the note, encrypt the answer with the method of symmetrical encryption, then pass it to me, even if the teacher got the note, I don’t understand the above content, take it. I can’t do it!

Drying, doing dry, Zhang San designed the following drawing procedures:

Zhang San privately told Li Fi: “Y = 3 (key).” Write on the blackboard: x + y = z (x Represents the answer, Z represents encryption, write on the note) According to this algorithm, encrypt the answer, write the value of Z’s value on the answer, pass the three three three to the note, decrypt the value, restore the answer

In this way, because Y = 3 (key) is only known to Zhang San and Li Si know, the invigilator even got the note, because there is no Y, the content of the note is unable to decrypt the contents of the note, and he can’t help him.

Zhang San told Li Si, Li Si Shen Ji, telling him the risk:

(1) How to ensure that the key does not leak?

In case, when we discuss the key, we have known other students, tell the teacher, then our heart is a waste of white.

(2) It is difficult to manage key management

If Li Si is here, you can only save the king. You have to discuss a key with Wang Wu. If Wang Five will not, you have to discuss a key with other students, so that the key is very More, what should I do if I don’t know?

Indeed, there is a lot of disadvantages of symmetrical encryption.

Asymmetric encryption

Unwilling Zhang San went back to turn the book again, this time he found a better way – asymmetric encryption.

Asymmetric encryption algorithms need to be used to use two keys: public key and private key. They are a pair, the public key is responsible for encrypting the data, and the private key is responsible for decryption data.

The benefits of asymmetric encryption are that the public key is disclosed, and anyone can use the public key encrypted data, but only the private key can decrypt, as long as Zhang San has gripped the private key, no one can decrypt the data.

So he started to design a process step of cheating:

(1) Zhang San write on the blackboard of the examination room: ((x * Y)% 1000) * m)% 1000, X is three digits, y = 91, y is public key: take the product of X and Y The latter three digits, then multiplied by M, after the three digits

Li Si uses public key encryption answers, and pass the three three-sheet data to the encrypted data, decrypt data with m = 11

Note: For example, if the correct answer is 111, 111 multiplied by 91 = 10101, after the three-digit 101 * 11 = 1111, then the three after the three are 111, you can restore the answer, this is because 91 * 11 = 1001, any three-digit multiplier will not change after 1001. The reason why Y = 91 is encrypted, but it can be decrypted using M = 11.

With an asymmetric encryption, Li Si, Wang Wu and other students can use Y = 91 (public key) encrypted answer, because M = 11 (private key) is only one known, so only he can decrypt the answer .

The whole process, Zhang San does not need to deliver the key to anyone. Naturally there is no leak risk, the key only needs a pair (a public key and a private key), which is also considerable.

After the design of the season was design, Zhang San shrewdd by Li Si. After listening to the school, Li Si nodded, but he immediately put forward a question:

Compared to symmetrical encryption, the security of asymmetric encryption is much higher, but the calculation is also more troublesome. It used to calculate x + y = z, and now become calculated ((x * Y)% 1000) * m)% 1000.

In this way, when Li Zi passed the answer to Zhang San, Zhang San would desperately decrypt, and the exam is over, and it is not finished.

What can I do?

Unwilling Zhang San again wants to think …

(Untrained …)