Home  >  Article  >  Backend Development  >  PHP encryption and decryption_PHP tutorial

PHP encryption and decryption_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:42:181149browse

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

PHP encryption and decryption_PHP tutorial __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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/654269.htmlTechArticleEncryption and decryption is a routine task. 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...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn