Simple Explanation: Symmetric VS Asymmetric Encryption Algorithm

Source: Internet
Author: User
Keywords public key encryption algorithm symmetric encryption algorithms asymmetric key encryption algorithm

Symmetric-key algorithm and asymmetric key encryption algorithm are just two encryption algorithms in cryptography. What is an algorithm, you can understand it as a rule. , This kind of rule can transform information from one form to another. It doesn’t matter if you don’t understand, continue to look down.

Alibaba Cloud Simple Application Server:  Anti COVID-19 SME Enablement Program
$300 coupon package for all new SMEs and a $500 coupon for paying customers.

Symmetric encryption

First of all, let us start with a situation, thinking that when we were in junior high school, high school, and even college, people tried to cheat more covertly every time we took an exam! So what method did everyone think of? For example, Zhang San studies better than Li Si, and Li Si wants to ask Zhang San to "help" himself during the exam. Of course, the two of them cannot say that as we usually do, choose A for the first question and B for the second question. Wait, why? Because the invigilator understands what they are talking about, that is to say, this communication method is "clear", so Li Si thought: "I need to invent a communication method that only Zhang San and I understand", then Li Si What did you do? Well, Li Si went to Zhang San and said, "Look at me when I cough three times in a row, and then if I touch my left ear, it means you can start to tell me the answer. If there is no response, it means I am really Is coughing...", Then, how to pass the answer? It’s very simple, “You touch the left ear to represent A, touch the right ear to represent B, put down your left hand to represent C, and put down your right hand to represent D”, well, this is their “algorithm (rule)”, which is a form of information (A ,B,C,D), here we call it "plaintext", which is transformed into another form (touching the left ear, touching the right ear, putting left hand, putting right hand), here called "ciphertext", after this Conversion, it is obvious that the invigilator will not understand these "ciphertexts". In this way, Zhang San and Li Si realized the exchange of information in the form of "ciphertexts".

In fact, isn't cryptography just for people to better encrypt transmission? There are many scholars and scientists working for many years in order to improve or invent better encryption algorithms so that

The text encrypted by these encryption algorithms is difficult to crack, achieving the purpose of data secure transmission.
OK, back to the topic, the above "cheating" example is actually a symmetric encryption algorithm! Well, let’s take a look at the definition of symmetric encryption algorithm (source: wikipedia): Symmetric-key encryption is also known as symmetric encryption, private key encryption, and shared key encryption. It is in cryptography One type of encryption algorithm. This type of algorithm uses the same key for encryption and decryption, or two keys that can be easily calculated from each other. In practice, this set of keys becomes a common secret between two or more members in order to maintain exclusive communication links. Compared with public key encryption, requiring both parties to obtain the same key is one of the main disadvantages of symmetric key encryption. Here I want to say that the Chinese translation of Symmetric-key algorithm by Wikipedia is symmetric key encryption. I don’t want to Translate this key into a secret key, because the key is just a "key". Translating into a key here will make everyone confused about the concepts of "public key", "key", "private key" and so on. , OK, so I still prefer to call it "symmetric encryption algorithm", and later it is also called "private key" encryption, shared "key", here, "private key" is equal to "key", without any The difference is "private key" in English.

Ok, we will define the corresponding with our previous example, "This type of algorithm uses the same key for encryption and decryption, or two keys that can be easily calculated from each other." In fact, in our example, the encryption The key is to "convert (A, B, C, D) into (touch left ear, touch right ear, put left hand, put right hand)" such a rule. "In practice, this set of keys becomes a common secret between two or more members in order to maintain exclusive communication links." This sentence is well understood. The key is the secret shared by Zhang San and Li Si. ! Only they know in advance.

So, why is it called symmetric encryption? You can understand it this way. After one party encrypts the information with a key, the ciphertext is transmitted to the other party, and the other party decrypts the ciphertext with the same key and converts it into an understandable plaintext. The relationship between them is as follows:
Plain text <-> key <-> cipher text
Looking at it this way, it is easier to understand whether it feels symmetrical. Ok, so are there any existing symmetric encryption algorithms we can use now? Of course there are: common symmetric encryption algorithms are DES, 3DES, AES, Blowfish, IDEA, RC5, RC6.
Students who want to know more can check the information by themselves.

Asymmetric encryption

Let's talk about asymmetric encryption again. Asymmetric encryption is a better encryption algorithm than symmetric encryption. Of course, the algorithm has advantages and disadvantages. Symmetric encryption is fast but its security is low compared to asymmetric encryption. Why, do you think? Ah, if you want to use symmetric encryption, each individual who shares information needs to share this key. For example, if you use the same key for ciphertext transmission between 1,000 of you, as long as one of the keys is stolen, Then the entire encrypted information will be cracked. Okay, then we start to talk about asymmetric encryption.
Starting from the shortcomings of the symmetric encryption mentioned above, how can one person's key be stolen instantly? At the very least, you can ensure that the ciphertext you send to others will not be cracked. So, people came up with such a way. First, we stopped sharing the common key, because the above bug comes from sharing a key, so what should we do? Everyone generates a "private key-public key" pair. This private key needs to be protected by everyone! The public key can be shared at will. As we will discuss in detail later, at the same time, the generated "private key-public key" pair has another powerful function, that is, the information encrypted with the private key can only be decrypted by the public key corresponding to the private key. , The information encrypted with the public key can only be decrypted by the private key corresponding to the public key!
Well, for example, Zhang San generated his own "private key-public key" pair called "Zhang San private key-Zhang San public key", and Li Si generated his own "private key-public key" pair, It is called "Li Si Private Key-Li Si Public Key". Before we said that the private key should be kept by each individual, and the public key can be shared freely. What is the purpose? It is to encrypt information!
For example, Li Si wants to send a ciphertext to Zhang San.
So Li Si started sending QQ to Zhang San
Li Si:
"Hi buddy, I want to send you a ciphertext and send me your public key for use."
Zhang San:
"No problem, this is my public key: d#8yHE8eU#hb*!neb, use this public key to encrypt your information and send it to me."
Li Si:
"This is what I want to say to you: *&#@uehuu(**#eehu&$##bfeu&&"
Yep? Are you in doubt? Keke, Li Si is this the rhythm of death? Why ask public key publicly? Are you afraid of being checked by the Internet police? Haha, the power of the asymmetric decryption algorithm is here! It doesn't matter! Whoever intercepts it! As we said above, the public key can be distributed at will, so even if someone intercepts it, they only know the public key, but if you want to decrypt the ciphertext encrypted with the public key! Only one person can do it! It's Zhang San! why? The information that Li Si uses Zhang San’s public key to encrypt, only the private key corresponding to Zhang San’s public key, here is "Zhang San’s private key", this private key can be decrypted! Therefore, a third party without Zhang San's private key intercepted these ciphertexts instantly, and couldn't crack them! Or more strictly speaking, it cannot be cracked by brute force in a limited time, say thousands of years!
got it? So the Internet police cried. They thought they wanted to monitor their conversations, but they got nothing!
Let's take a look at the official definition of asymmetric encryption:
Public key cryptography (also translated as public key encryption), also known as asymmetric encryption, a type of cryptographic algorithm, in this cryptographic method, a pair The key (in fact, the key word here is not good, it is "key"), one is a private key, and the other is a public key. These two keys are mathematically related, and the information obtained after being encrypted with a certain user's key can only be decrypted with the user's decryption key. If one of them is known, the other cannot be calculated. Therefore, if one of a pair of keys is disclosed, the secret nature of the other will not be compromised. The public key is called the public key; the undisclosed key is the private key.
This definition is a bit convoluted, but that is to say, if you want to use an asymmetric encryption algorithm, you must first have a pair of keys, one is called a private key, and the other becomes a public key. Then you can distribute your public key to The user who you pass the ciphertext, and then the user uses the public key to encrypt the ciphertext, which can only be decrypted by using your private key. That is to say, as long as you save your private key, you can ensure that others want to give you The sent ciphertext will not be cracked, so you don't have to worry about others' keys being stolen, it doesn't matter.

Precisely because this encryption is one-way, it is called an asymmetric encryption algorithm.

This encryption algorithm is widely used, such as SSH, HTTPS, TLS, electronic certificates, electronic signatures, electronic ID cards and so on.
This article is written here first, and then I will introduce the application of these encryption algorithms to you one by one, but I am here to bury the foreshadowing. The Li Si and Zhang San mentioned above are sending qq, and immediately use asymmetric encryption algorithms, everyone Have you discovered any hidden dangers?
Give some hints. For example, a certain cyber police wants to know what message Li Si wants to send Zhang San? The cyber police wants to crack Li Si's ciphertext, so what way can the cyber police get the information Li Si wants to send? Obviously, it is impossible to directly brute force the ciphertext!
Related Article

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.