The DES_ENCRYPT() function encrypts the "String" with the specified "Key" using the Triple-DES algorithm.
Without a "Key" argument, the first key from the DES key file is used: key number 0.
For a "Key" with a numeric argument, the specified key number (0-9) from the DES key file is used.
With a "Key" with string argument, the specified string is used to encrypt "String".
The return is a binary string where the first character is CHAR(128+Key-no) or CHAR(255).
If a character string is used as "Key", the first character is CHAR(255) (0xFF), otherwise CHAR(128+Key-no)< /b> (0x80).
If a numeric value is specified as the "Key", it must be between 0 and 9, otherwise the function returns NULL.
If an error occurs, the DES_ENCRYPT() function returns NULL.
Numeric values in the "String" argument are interpreted as a character string.
If "String" contains no characters, an empty string is returned.
If the value of the "String" argument is NULL, the DES_ENCRYPT() function returns NULL.
The key file can be specified with the --des-key-file server option.
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 DES_DECRYPT() function can be used for decryption. |