mysql encryption method

亚连
Release: 2018-05-10 10:28:14
Original
2167 people have browsed it

By encrypting the data in the Mysql database, we can make the database more secure, and the information and data inside will not be easily cracked.

MySQL has specially designed some functions to encrypt data. Here is a brief introduction to the following functions.

(1) AES_ENCRYPT and AES_DECRYPT functions

The syntax format is: aes_encrypt aes_decrypt(str,key)

The AES_ENCRYPT function returns The key key pair string str is encrypted using the Advanced Encryption Standard (AES) algorithm. The result is a binary string stored in the BLOB type. The AES_DECRYPT function is used to decrypt data encrypted with advanced encryption methods. If invalid data or incorrect padding is detected, the function returns NULL. The AES_ENCRYPT and AES_DECRYPT functions can be regarded as the most secure encryption functions commonly used in MySQL.

(2) ENCODE and DECODE functions

The syntax format is: encode |deCODE(str,key)

The ENCODE function is used to encode a character The string str is encrypted, and the returned result is a binary string stored in the BLOB type. The DECODE function decrypts the encrypted value using the correct key. Compared with the AES_ENCRYPT and AES_DECRYPT functions above, these two functions are relatively weak in encryption.

(3) ENCRYPT function

Use the UNIX crypt() system to encrypt a string. The encrypt(str, salt) function receives the string to be encrypted and is used for encryption. The salt of the process (a string that determines a unique password). Not available on Windows.

The above are the encryption functions that come with Mysql. I have briefly introduced a few. You can continue to add explanations in the comments below. . .

Related articles:

Related knowledge about PHP MySQL Order By keyword

How to read data through PHP MySQL

Related knowledge about PHP MySQL prepared statements

The above is the detailed content of mysql encryption method. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!