With the development of symmetric cipher, the DES data Encryption Standard algorithm, because of its small key length (56 bits), has not adapted to the requirements of today's distributed open Network for data encryption security, so 1997 NIST
Example of AES encryption and decryption in php. AesDemo. php: for example, copy the code as follows :? Phprequire_once (. AES. php); $ aesnewAES (true); store the encrypted string in hexadecimal format. aesDemo. php:
Example,
The code is as
AES encryption is a very advanced encryption. many people say it is very difficult to crack AES encryption. the following section describes an example of how to use the AES encryption algorithm to encrypt data. when studying Discuz, we found that
One of the problems encountered in the project:
Java end needs to have some data AES encrypted to C # end, find a lot of information, be solved, share:
Import Sun.misc.BASE64Decoder;
Import Sun.misc.BASE64Encoder;
Import Javax.crypto.Cipher;
Import
Put the code first. There are two files: AES. php (aes algorithm file) and aesDemo. php (application instance file) aesDemo. php:
Example,
The Code is as follows:
Require_once ('./AES. php ');// $ Aes = new AES ();$ Aes = new AES (true); //
First, the basic concept of AES algorithm
AES is the abbreviation of Advanced Encryption Standard (Advanced encryption Standard), AES has the following three characteristics.
1 AES is symmetric encryption algorithm
The concept of symmetric
aesdemo.php:
Example
Copy Code code as follows:
Require_once ('./aes.php ');
$aes = new Aes ();
$aes = new Aes (TRUE);//To store the encrypted string in hexadecimal
$aes = new Aes (true,true);//With debug information and
AesDemo. php:
Example,
Copy codeThe Code is as follows:Require_once ('./AES. php ');// $ Aes = new AES ();$ Aes = new AES (true); // stores encrypted strings in hexadecimal format.// $ Aes = new AES (true, true); // The encrypted string is stored in
With the development of symmetric passwords, The des Data Encryption Standard algorithm has a small key length (56 bits) and is no longer applicable to the requirements of distributed open networks for data encryption security, therefore, in 1997,
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.