Php encryption and decryption. Encryption and decryption are common tasks. Generally, passwords registered by users are not stored in plain text, so you must add a password first. The simplest of course is to call the md5 function in the Database SQL statement to encrypt and decrypt user passwords. Generally, passwords registered by users are not stored in plain text, so you must add a password first.
The simplest of course is to call the md5 function in the Database SQL statement to encrypt the user password. Here is an encryption/decryption class. If you want to retrieve the original password when the user forgets the password, this class is a useful tool. Of course, this encryption/decryption class can also be used for other purposes.
View source code
Skey = hash ("md5",); safe_b64encode (= ('+', '/', '= '),('-','_', ''), safe_b64decode (= ('-', '_'), ('+', '/'), = () % 4 (. = ('=', (encode ((! = Mcrypt_get_iv_size (Cipher, = mcrypt_create_iv (, = mcrypt_encrypt (Cipher,-> skey, MCRYPT_MODE_ECB, (-> safe_b64encode (decode ((! =-> Safe_b64decode (= mcrypt_get_iv_size (ciphertext, = mcrypt_create_iv (, = mcrypt_decrypt (ciphertext,-> skey, MCRYPT_MODE_ECB ,(}View Code
Bytes. Generally, passwords registered by users are not stored in plain text, so you must add a password first. The simplest of course is to call the md5 function in the Database SQL statement to encrypt user passwords...