I did this when I was a child. When I wrote a diary, I thought of this method to make myself understand it and not let others understand it.
Diary content: I think 255 or 1989 prefer 201. Do you know what this means? It is implemented through a naive and SIMPLE algorithm. The comparison between the 26 English letters and Chinese letters is boring, but it was mysterious (the child's mind ). In any case, we know what encryption is and what decryption is.
1. Relationship between encryption, decryption, and Algorithms
A piece of original data is processed into another type of data through a certain algorithm (the original data is plain text, and the processed data is ciphertext ). Plaintext -----> ciphertext is called encryption; ciphertext ----> plaintext is called decryption;
Therefore, the algorithm itself is critical for encryption and decryption. But the algorithm is open. Once some people want to crack the algorithm and it is cracked, all the products that use the algorithm will be scrapped, and replacing an algorithm consumes a lot of capital. After all, finding a suitable algorithm is not a simple task. Therefore, the reliability of an encrypted data depends on the key, not the algorithm, because the password exchange cost is very low.
2. What is a key?
A key is a parameter that is input in the plaintext-> ciphertext or ciphertext-> plaintext algorithm. It can be divided into symmetric keys and asymmetric keys.
Symmetric key encryption: Also known as private key encryption, that is, the sender and receiver use the same key to encrypt and decrypt data. The advantage is that encryption/decryption is fast and suitable for encrypting big data, but key management is difficult (because it is difficult to use the same key to send it to different recipients. If there are many recipients, key recording is an arduous task)
Asymmetric key encryption: Also known as public key encryption. Different keys are required for encryption and decryption respectively. One public release is the public key, and the other is secretly saved by the user, that is, the private key. The sender encrypts the data with the other party's public key, and the other party decrypts the data with its own private key. The disadvantage is that encryption/decryption is much slower than symmetric keys.
Iii. encryption algorithms
Symmetric encryption algorithm public key encryption algorithm one-way encryption algorithm
1. symmetric encryption algorithm: the principle of symmetric key encryption is the same as that described above.
As you can see, the sender and receiver use the same key, but never thought about it. How can the receiver obtain the key? Call? Text message? Or write a letter? Shouldn't it be? Where is security? (The following Public Key decryption algorithm can solve this problem)
2. public key encryption algorithm: the principle of asymmetric key secret is the same as that described above.
As you can see, the sender and receiver use different keys. The sender uses the receiver's public key for encryption and the receiver uses the paired private key for decryption. During the entire transmission process, the encrypted data can only be decrypted by the receiver, because only the receiver has its own private key. As mentioned above, this encryption takes a long time and is not an ideal encryption method.
Therefore, the Public Key decryption algorithm has two main functions:
1. To achieve key exchange, there is such a problem in the symmetric encryption algorithm. here we can use the public key algorithm to achieve how the other party obtains the key. You can use the public key encryption algorithm to encrypt the key and send it to the other party.
2. Digital Signature. You can use the public/private key for encryption. The opposite is to use the private/public key for decryption. Therefore, if the sender uses its own private key for encryption, it must use the sender's public key for decryption, which proves the authenticity of the sender and plays a role in anti-denial.
Note: The public key is extracted from the private key.
The combination of symmetric encryption and public key encryption ensures data confidentiality and source legitimacy. But how can we solve the data integrity? How can the receiver determine if the data is intercepted illegally and then altered in disorder, undermining the data integrity?
3 one-way encryption algorithm
To be precise, one-way encryption algorithms are not a type of encryption technology. Instead, they extract data signatures to verify data integrity.
Features:
Avalanche effect: any small change will produce a huge difference, that is, as long as the data changes a little, the results will be very different.
Fixed-length output: No matter how big the data is, the extracted signatures are of the same length.
The above three algorithms are not independent. They should be combined for use. Ultimately, data reliability, integrity, confidentiality, and source legitimacy are ensured.
Next, let's demonstrate this process. James ----> Xiaomei sends the data "love confession"
Summary: Signature extraction is used to ensure data integrity. Encryption with your own private key is used for identity authentication. Encryption with the other party's public key ensures confidentiality and can be decrypted by the other party;
The three basic encryption algorithms are OK now.
From: "Happy now" blog