Mysql encryption functions are: 1. [DECODE(str,key)] uses key as the key to decrypt the encrypted string str; 2. [AES_DECRYPT(str,key)] returns the key pair string str is the result of decryption using the Advanced Encryption Standard algorithm.
mysql encryption functions are:
1,AES_ENCRYPT(str,key)
: Returns the result of encrypting the string str using the Advanced Encryption Standard algorithm using the key key. The result of calling AES_ENCRYPT is a binary string stored in the BLOB type.
2,AES_DECRYPT(str,key)
: Returns the result of decrypting the string str using the Advanced Encryption Standard algorithm using the key key.
3,DECODE(str,key)
: Use key as the key to decrypt the encrypted string str.
4,ENCRYPT(str,salt)
: Use the UNIXcrypt() function to encrypt the string str using the keyword salt (a string that can uniquely determine the password, just like a key) .
5,ENCODE(str,key)
: Use key as the key to encrypt the string str. The result of calling ENCODE() is a binary string, which is stored in the BLOB type.
6,MD5()
: Calculate the MD5 checksum of the string str.
7,PASSWORD(str)
: Returns the encrypted version of the string str. This encryption process is irreversible and uses a different algorithm from the UNIX password encryption process.
8,SHA()
: Calculate the Secure Hash Algorithm (SHA) checksum of the string str.
Example:
SELECT ENCRYPT('root','salt'); SELECT ENCODE('xufeng','key'); SELECT DECODE(ENCODE('xufeng','key'),'key');#加解密放在一起 SELECT AES_ENCRYPT('root','key'); SELECT AES_DECRYPT(AES_ENCRYPT('root','key'),'key'); SELECT MD5('123456'); SELECT SHA('123456');
Related learning recommendations:mysql video tutorial
The above is the detailed content of What are the mysql encryption functions?. For more information, please follow other related articles on the PHP Chinese website!