Introduce several of the most common encryption and decryption methods

Encryption and decryption are the most commonly used means of data conversion in communications. The basic process of encryption is to apply encryption algorithms and keys to encrypt plaintext (unencrypted original text), convert it into ciphertext and send it; the basic process of decryption is to receive ciphertext After that, apply the corresponding algorithm and the same key to decrypt the ciphertext and convert it into plaintext;

The two parties of encryption and decryption perform encryption or decryption according to the basic agreement in advance (including the encryption algorithm) and the given key, but the third party does not know the agreement, even if they know the ciphertext and key, it is difficult to decrypt and understand the content of the communication. The following is an introduction to the most common encryption and decryption methods.

1.Base64 bit encryption (can be encrypted and decrypted)

The simplest encryption method without a key. This method can be directly decrypted as long as others get your ciphertext. It can only be used to confuse. Generally, it is not used alone, because it is really useless~ It can be mixed with other encryption methods as an external package.

2.MD5 encryption (encryption irreversible)

The full name of MD5 is Message-Digest Algorithm 5 (information-digest algorithm). 128-bit length. Currently MD5 is an irreversible algorithm. It has high security. It corresponds to any character string that can be encrypted into a unique fixed-length code. (Tip: Why is the MD5 encryption algorithm irreversible? Logically speaking, if there is an encryption method, there will be a decryption method? Because MD5 encryption is a lossy encryption method. For example, a piece of data is '123'. When encrypting, 1 and 3 are directly regarded as a, and become 'a2a' after encryption, so there are 4 combinations '323''121''123''321' when decrypting, and there are more than one data , naturally the original data cannot be found, and of course the ciphertext encrypted in this way does not need to be decrypted, just send the original ciphertext directly when needed~ but the original content of the ciphertext cannot be seen)

3.sha1 encryption (encryption is irreversible)

The full name of SHA1 is Secure Hash Algorithm (secure hash algorithm). SHA1 is based on MD5, and the encrypted data length is longer. It produces a hash value with a length of 160 bits for an input whose length is less than 264. 32 bits more than MD5. Therefore, it is more secure than MD5, but the operation speed of SHA1 is slower than MD5. The method of use is actually the same as MD5.

4. AES encryption (requires a key to decrypt)

AES encryption is symmetric key encryption, encryption and decryption use the same decryption rule, the AES encryption process operates on a 4×4 byte matrix, this matrix is ​​also called "state (state)", because the key The encryption block needs to be iterated, replaced, and combined multiple times on the matrix, so there are certain requirements for the encryption block and the number of bytes of the key. The minimum supported length of the AES key is 128, 192, and 256. The encrypted block is grouped The length is 128 bits. This encryption mode has one biggest weakness: Party A must tell Party B the encryption rules, otherwise it cannot be decrypted. Saving and transferring the key has become the most troublesome problem.

5. RSA encryption (public key encryption, private key decryption)

It is currently the most important encryption algorithm! The cornerstone of computer communication security, ensuring that encrypted data cannot be cracked. You can imagine the consequences of a credit card transaction being hacked. Party A and Party B communicate, Party B generates a public key and a private key, Party A obtains the public key, and encrypts the information (the public key is public, and anyone can obtain it), and Party A encrypts the information with the public key. Only the private key can crack the information, so as long as the private key is not leaked, the security of the information can be guaranteed.

The above is the entire content of "Introduction to several of the most common encryption and decryption methods" shared with you.

Guess you like

Origin blog.csdn.net/lavin1614/article/details/131191824