AES_DECRYPT()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Decrypts data using the AES algorithm with the given key.
USAGE
AES_DECRYPT(encrypted_string, key_string)
Argument Name | Description |
|---|---|
| The encrypted string to decrypt |
| The decryption key to use |
DETAILS
AES_DECRYPT() is an encryption function that decrypts a string using Advanced Encryption Standard (AES).
The same key string that was used during encryption needs to be used to successfully decrypt the encrypted string.
A NULL is returned if any of the arguments is NULL.
EXAMPLES
SET @key_str = SHA2('passphrase', 512);
SET @enc_str = 'B8656AA940B6D6ABAD5DA4891E746ED9';
SELECT AES_DECRYPT(UNHEX(@enc_str), @key_str) AS result;
+--------+
| result |
+--------+
| hello |
+--------+
