©SQL :: Manager
HomeProgram InformationTechnical detailsFree downloadDonate for a cup of coffee
myway SQL Manager for MySQL and MariaDB, Download on Uptodown
SQL functionMySQLMariaDB

MariaDB DES_DECRYPT SQL Function - Decrypt with Triple-DES-Algorithmus

DES_DECRYPTSyntax:DES_DECRYPT(Binary string [, Key])
Return value:CHAR
Function type:Encryption & Compression
Function Description

The DES_DECRYPT() function decrypts a "Binary string" with the given "Key" using the triple-DES algorithm.

Without a "Key" argument, the key number contained in the first character of the "Binary string" is used.

If "Binary string" was encrypted with a key number and that number is provided in the "Key" argument, the function returns NULL.

If "Key" is a string argument, the specified string is used to decrypt "Binary string".

Returns a string or NULL if an error occurs.

If "Binary string" contains no characters, an empty string is returned.

If the value of the "Binary string" argument is NULL, the DES_DECRYPT() function returns NULL.


This feature only works if MariaDB has been configured with TLS support.

As of MariaDB 10.10, this feature is deprecated and will be removed in future releases.

This feature is not present in MySQL 8.0.


The function DES_ENCRYPT() can be used for encryption.

SQL Examples for the DES_DECRYPT function

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15

select des_decrypt(unhex('80EA0A9DB4CC10869F'));
select des_decrypt(unhex('FFA0ABBB0826A039EE'), 'Key');
select des_decrypt(unhex('89EA0A9DB4CC10869F'));

select des_decrypt(unhex('80EA0A9DB4CC10869F'), 0);
select des_decrypt(unhex('89EA0A9DB4CC10869F'), 9);

select des_decrypt(unhex('80AE77A7D188B8CB6F'));
select des_decrypt(unhex('FFFFAE19DABE7DFBF6'), 'Key');

select des_decrypt(unhex('FFFFAE19DABE7DFBF6'));
select des_decrypt('''Key');
select des_decrypt(null'Key');

des_decrypt(unhex('80EA0A9DB4CC10869F'))
varchar(0) BINARY
Test
des_decrypt(unhex('FFA0ABBB0826A039EE'), 'Key')
varchar(0) BINARY
Test
des_decrypt(unhex('89EA0A9DB4CC10869F'))
varchar(0) BINARY
Test
des_decrypt(unhex('80EA0A9DB4CC10869F'), 0)
varchar(0) BINARY
NULL
des_decrypt(unhex('89EA0A9DB4CC10869F'), 9)
varchar(0) BINARY
NULL
des_decrypt(unhex('80AE77A7D188B8CB6F'))
varchar(0) BINARY
123456
des_decrypt(unhex('FFFFAE19DABE7DFBF6'), 'Key')
varchar(0) BINARY
123456
des_decrypt(unhex('FFFFAE19DABE7DFBF6'))
varchar(0) BINARY
NULL
des_decrypt('', 'Key')
varchar(0) BINARY
 
des_decrypt(null, 'Key')
varchar(0) BINARY
NULL
The examples were created with the MyWAY SQL manager: Download

How to use the DES_DECRYPT() function in MySQL and MariaDB databases

MariaDB provides the DES_DECRYPT() function, which is used to decrypt data encrypted with the DES encryption algorithm (Data Encryption Standard). The function takes the encrypted data and a key as input and returns the decrypted value as a string. It is important to note that the DES encryption algorithm used by the function requires that the data has been encrypted using the corresponding DES_ENCRYPT() function with the same key, otherwise the decryption process will fail and the function returns NULL.

The feature is specific to MariaDB and may not be available in other database systems.
DECODE_ORACLEDEFAULTDEGREESDES_DECRYPTDES_ENCRYPTELTENCODE

Further MySQL und MariaDB SQL Encryption & Compression

AES_DECRYPTAES_DECRYPT(String, Key)
More about AES_DECRYPT Function

AES_ENCRYPTAES_ENCRYPT(String, Key)
More about AES_ENCRYPT Function

COMPRESSCOMPRESS(String)
More about COMPRESS Function

DECODEDECODE(Binary string, Password)
More about DECODE Function

DES_ENCRYPTDES_ENCRYPT(String [, Key])
More about DES_ENCRYPT Function

ENCODEENCODE(String, Password)
More about ENCODE Function

ENCRYPTENCRYPT(String [, Salt])
More about ENCRYPT Function

FROM_BASE64FROM_BASE64(String)
More about FROM_BASE64 Function

MD5MD5(String)
More about MD5 Function

OLD_PASSWORDOLD_PASSWORD(String)
More about OLD_PASSWORD Function

PASSWORDPASSWORD(String)
More about PASSWORD Function

RANDOM_BYTESRANDOM_BYTES(Length)
More about RANDOM_BYTES Function

SHASHA(String)
More about SHA Function

SHA1SHA1(String)
More about SHA1 Function

SHA2SHA2(String, Length)
More about SHA2 Function

TO_BASE64TO_BASE64(String)
More about TO_BASE64 Function

UNCOMPRESSUNCOMPRESS(Binary string)
More about UNCOMPRESS Function

Numeric functionsString functionsRegular ExpressionsDate and Time functions
Comparison functionsEncryption & CompressionConversion functionsNULL functions
Aggregate functionsWindow functionsJSON functionsGeometric functions
Sequence functionsInformation functionsDynamic ColumnsMiscellaneous functions
More information about the DES_DECRYPT SQL function: mariadb.com
Updated: 2023-09-17ImprintContactTerms & conditionsPrivacy & CookiesUpdatesSitemapFacebookLinkedinTwitterStatistics©2020-2024 Heino Cunze-Fischer