Product Solutions Support
Try MemSQL

AES_DECRYPT

Decrypts the given ciphertext using the AES (Advanced Encryption Standard) algorithm, with a 128-bit key.

AES_DECRYPT(ciphertext, key)

Arguments

Return Type

The plain text, or NULL if the key does not decrypt the ciphertext.

Examples

Note: the [UNHEX] function is used in this example to make it easier to handle binary data.

memsql> select AES_DECRYPT(unhex('C958FF3BC0134ADE4A8F952338C1FAEC'), 'ohai');
+----------------------------------------------------------------+
| AES_DECRYPT(unhex('C958FF3BC0134ADE4A8F952338C1FAEC'), 'ohai') |
+----------------------------------------------------------------+
| secret message                                                 |
+----------------------------------------------------------------+

memsql> select AES_DECRYPT(unhex('C958FF3BC0134ADE4A8F952338C1FAEC'), 'bad key');
+-------------------------------------------------------------------+
| AES_DECRYPT(unhex('C958FF3BC0134ADE4A8F952338C1FAEC'), 'bad key') |
+-------------------------------------------------------------------+
| NULL                                                              |
+-------------------------------------------------------------------+
Was this article useful?