Home > Article > Backend Development > PHP encryption and decryption_PHP tutorial
Encryption and decryption is a routine task. The password registered by the user is generally not saved in plain text and must be encrypted first.
Of course the simplest is 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.
View source code
__construct( ->skey = hash("md5", , ); safe_b64encode( = ( = ((' +', '/', '='), ('-', '_', ''), safe_b64decode( = (('-', '_'), ('+', ' /'), = () % 4 ( . = ('====', ( encode( (! = = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, = mcrypt_create_iv(, = mcrypt_encrypt (MCRYPT_RIJNDAEL_256, ->skey, , MCRYPT_MODE_ECB, (->safe_b64encode( decode( (! = ->safe_b64decode( = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, = mcrypt_create_iv(, = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, ->skey, , MCRYPT_MODE_ECB, ( } View Code