Questions about encryption algorithms and encryption modes in Mcrypt 1. & nbsp; learn about php encryption and decryption. what principles are these encryption algorithms and Encryption Modes? what materials should I read? 2. & nbsp; what is the basis for encryption and decryption? For example, is it possible to convert the UTF-8 text into a hexadecimal number and then encrypt it, or directly convert it into binary for encryption, or other forms? Encryption algorithms and encryption modes in Mcrypt
1. I want to learn about php encryption and decryption. What are the principles and materials of these encryption algorithms and encryption modes?
2. what is the basis for encryption and decryption? For example, is it possible to convert the UTF-8 text into a hexadecimal number and then encrypt it, or directly convert it into binary for encryption, or other forms?
3. Usually, what key must be used to replace plaintext with reversible encryption?
------ Solution --------------------
1. The principle is that the plaintext + key = ciphertext + key = the complexity of the plaintext algorithm is determined by the complexity of the encryption algorithm. of course, the more complex the data length will increase. Depending on the program, especially important information, such as the user password, you can choose a more complex encryption algorithm.
2. encryption and decryption rules for each algorithm are different. encryption algorithms are not uniform. you can also write an encryption algorithm yourself.
3. key principle:
Generate a pair of public keys and private keys using a tool (I used the openssl command in linux last time.
The public key can be told by others, while the private key is left for you.
When someone else uses the public key to encrypt and send data, this data can only be decrypted with the private key. it is useless for others to see the data encrypted with the public key during the process.
Asymmetric Encryption: Public key a private key B client data c + a = z sent to the server z + B = c
The main advantage of non-symmetry is that it is much safer than other encryption modes. The main disadvantage is that the algorithm is complex, the encryption speed is slow, and the encrypted data is also very large.
Therefore, symmetric encryption and non-symmetry have their own advantages and disadvantages. programmers should select encryption methods based on different needs!
(They all have personal opinions and opinions. if there is something wrong with it, please do not hesitate to point it out !)
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.