During the project development process, sometimes we need to use PHP to encrypt specific information, that is, to generate an encrypted string through the encryption algorithm. This encrypted string can be decrypted through the decryption algorithm to facilitate the program to decrypt the decrypted string. information is processed. The most common applications are in user login and some API data exchange scenarios.
In our php Chinese websiteClass library downloadoption, some PHP encryption and decryption class libraries are summarized. Interested friends can enter the website class library download page to download and learn.
1.A Php Aes encryption class library
A Php Aes encryption class program, suitable for Yii extensions if not used in the Yii framework , just replace Yii::app()->params[\'encryptKey\'] in the code with your corresponding default key.
AES Encryption Algorithm – Algorithm Principle
AES algorithm is based on permutation and substitution AES uses several different methods to perform permutation and permutation operations.
AES is an iterative, symmetric key grouping cipher , it can use 128, 192 and 256-bit keys, and encrypt and decrypt data with 128-bit (16 bytes) blocks. Unlike public key cryptography, which uses key pairs, symmetric key cryptography uses the same key to encrypt and decrypt data. To decrypt the data, the encrypted data returned by the block cipher has the same number of bits as the input data. Iterative encryption uses a loop structure in which the input data is repeatedly permuted and replaced.
2.php supports Chinese and English encryption and decryption classes
This php encryption class is a php implementation class file that can support Chinese and English encryption and decryption. , friends in need can refer to it, but it is best to set the document encoding to utf-8.
3.php-3des encryption and decryption class
##3DES( Triple DES (or Triple DES) is the general name for Triple Data Encryption Algorithm (TDEA, Triple Data Encryption Algorithm) block cipher. It is equivalent to applying the DES encryption algorithm three times to each data block. Due to the enhancement of computer computing power, the encryption of the original DES cipher is The key length becomes easy to be cracked by brute force. 3DES is designed to provide a relatively simple method to avoid similar attacks by increasing the key length of DES, rather than designing a completely new block cipher algorithm. 4.php string encryption and decryption class
Share a php string encryption and decryption class, use the base64_encode() function to encode the string. This encoding is designed to enable binary data to be transmitted over a transport layer that is not pure 8-bit, such as the body of an email. 5.PHP Password Lib: A goal is to provide an all-inclusive encryption php library for all encryption
PHP-PasswordLib is a goal for all encryption Provides an all-inclusive encryption php library. This is designed to be easy to install and use, yet scalable and powerful enough for even the most experienced developers. 6.DES encryption and decryption PHP class
DES encryption and decryption PHP class, obtain the physical address, encrypt the plain text information, decrypt the cipher text, and Save the ciphertext to a file, obtain the MAC address of the server, and execute the ipconfig command on the Windows server and the ifconfig command on the Linux server. 7.php code class for encrypting and decrypting the project
Encrypt the php project. Note that if there is a framework directory or a directory that does not need to be encrypted in the project, Please move out in advance.Set the value of the variable; it can be processed according to needs. If the if judgment is directly removed, it means that the value of any attribute can be set, including non-existent attributes
8.php encryption and decryption function class
A relatively complete one PHP encryption and decryption function class. Encryption process:Read the source file, encrypt it with base64_encode, and use the 52 uppercase and lowercase letters obtained by mixing as the secret key for replacement
$c=strtr (ciphertext, corresponding to the replacement letters, the letters to be replaced);
Link the two secret keys and the ciphertext to form the main content of the file to be encrypted
Finally, according to the template format written in advance, base64_decode, strtr, substr respectively Combine the commands, put the combined ciphertext into the template and base64_encode it here,
write the file to be encrypted.
Read the file to be decrypted, intercept the string starting with eval, and then intercept hierarchically to obtain the ciphertext generated in the encryption template
base64_decode decryption to obtain the decrypted plaintext
Intercept the obtained name text, intercept the characters of the secret key + ciphertext formed by the source file, and execute the intercepted characters through eval to assign the ciphertext to a predefined variable ($O0O000)
By executing base64_decode (strtr(substr($O0O000,52*2),substr($O0O000,52,52),substr($O0O000,0,52)));
Decrypt and write the decrypted content (plain text) Import the file.
9.php encryption and decryption utility class
If you want to retrieve the original password for the user when he or she forgets it, then this class is a useful tool. The password registered by the user is generally not saved in plain text and must be encrypted first. The simplest is of course to call the md5 function in the database sql statement to encrypt the user password. Here we introduce an encryption and decryption class. This class is a useful tool if you want to retrieve a user's original password when he or she forgets it. Of course, this encryption and decryption class can also be used for other purposes.
10.Powerful PHP encryption and decryption class
A powerful PHP encryption and decryption class. The construction parameter is the key, which performs some encryption and decryption of strings. operation.
For more related class library downloads, please pay attention to: //m.sbmmt.com/xiazai/leiku
[Related class library recommendations]
2.php paging class code sharing: the latest 10 php in 2017 Pagination class code download
3.【php thumbnail class】The latest 10 libraries that use php to generate thumbnails download
4.【 PHP Verification Code] Share 10 useful PHP verification codes