PHP in the OpenSSL function library. Provides a number of functions. But the most common thing we use is
Openssl_encrypt
1 string string $data string $method string $key $options string $iv string &$tagNULLstring$aad$tag _length = 16] ]]]] )
The first parameter is the data to encrypt.
The second encryption method. The supported encryption methods can be obtained by Openssl_get_cipher_methods . such as AES-256-CBC, etc.
The third parameter is a secret key.
A fourth parameter. You can select a 0 fill. or raw data. OPENSSL_RAW_DATA, OPENSSL_ZERO_PADDING .
The fifth parameter is offset, such as CBC mode, which requires this.
Openssl_encrypt ("111111", "DES-CBC", "12345678", openssl_zero_padding, "11111")
Openssl_decrypt
Decrypt.
String Openssl_decrypt (String $data, String $method, String $key [, int $options = 0 [, String $iv = "" [, String $tag = "" [, String $aad = ""]]])
Basically consistent with encryption. How to encrypt, how to untie.
PHP OpenSSL function Library