MySQL | AES_ENCRYPT ( ) Function Last Updated : 25 Aug, 2021 Comments Improve Suggest changes Like Article Like Report The MySQL AES_ENCRYPT function is used for encrypting a string using Advanced Encryption Standard (AES) algorithm. The MySQL AES_ENCRYPT function encodes the data with 128 bits key length but it can be extended up to 256 bits key length. It encrypts a string and returns a binary string. The value returned by the AES_ENCRYPT function is a binary string or NULL if the argument in NULL. The AES_ENCRYPT function accepts two parameters which are the encrypted string and a key string used to encrypt the string. Syntax: AES_ENCRYPT(str, key_str) Parameters Used: str - It is used to specify the plain string.key_str - It is used to specify the String which is used to encrypt the str. Return Value: The AES_ENCRYPT function in MySQL returns a binary string. Supported Versions of MySQL: MySQL 5.7MySQL 5.6MySQL 5.5MySQL 5.1MySQL 5.0MySQL 4.1 Example-1: Implementing AES_ENCRYPT function on a string. SELECT AES_ENCRYPT('ABC', 'key'); Output: \\YJ??f&K?M?q?* Example-2: Implementing AES_ENCRYPT function on a bigger string. SELECT AES_ENCRYPT('geeksforgeeks', 'key'); Output: 2G???B?????*?? Example-3: Implementing AES_ENCRYPT function on a NULL string. SELECT (AES_ENCRYPT(NULL, 'key'); Output: NULL Comment More infoAdvertise with us Next Article MySQL | AES_ENCRYPT ( ) Function S Shubrodeep Banerjee Follow Improve Article Tags : SQL mysql SQLmysql Similar Reads MySQL | AES_DECRYPT ( ) Function The MySQL AES_DECRYPT function returns the original string after decrypting an encrypted string. It uses AES(Advanced Encryption Standard) algorithm to perform the decryption. The AES_DECRYPT function returns the decrypted string or NULL if it detects invalid data. The value returned by the AES_DECR 1 min read MySQL | DES_ENCRYPT ( ) Function In todayâs world, keeping data safe is important for any database. MySQL, one of the most popular database systems, offers various tools to secure your information. Among these is the DES_ENCRYPT() function, which uses the Data Encryption Standard (DES) algorithm to encrypt your data. This function 3 min read SQL | ENCRYPT Function The SQL Encrypt function is used to encrypt a string using UNIX crypt(). The function is based on Unix crypt() system call, hence it returns NULL on Windows systems. The Encrypt function accepts two parameters which are the string and the salt to be encrypted. The Encrypt function returns a binary s 2 min read MySQL | BINARY Function The MySQL BINARY function is used for converting a value to a binary string. The BINARY function can also be implemented using CAST function as CAST(value AS BINARY). The BINARY function accepts one parameter which is the value to be converted and returns a binary string. Syntax: BINARY value Parame 1 min read MySQL | CONVERT( ) Function The MySQL CONVERT() function is used for converting a value from one datatype to a different datatype. The MySQL CONVERT() function is also used for converting a value from one character set to another character set. It accepts two parameters which are the input value and the type to be converted in 2 min read Like