Syntax\n------\n\nDES_ENCRYPT(str[,{key_num|key_str}])\n\nDescription\n-----------\n\nEncrypts the string with the given key using the Triple-DES algorithm.\n\nThis function works only if MariaDB has been configured with TLS support.\n\nThe encryption key to use is chosen based on the second argument toDES_ENCRYPT(), if one was given. With no argument, the first key from the DES key file is used. With a _key_num_ argument, the given key\\\nnumber (0-9) from the DES key file is used. With a _key_str_ argument, the given key string is used to encrypt _str_.\n\nThe key file can be specified with the --des-key-file server option.\n\nThe return string is a binary string where the first character isCHAR(128 | key_num). If an error occurs, DES_ENCRYPT() returns NULL.\n\nThe 128 is added to make it easier to recognize an encrypted key. If you use a string key, _key_num_ is 127.\n\nThe string length for the result is given by this formula:\n\n``sql\nnew_len = orig_len + (8 - (orig_len % 8)) + 1\n`\n\nEach line in the DES key file has the following format:\n\n`sql\nkey_num des_key_str\n`\n\nEach _key_num_ value must be a number in the range from 0 to 9. Lines in the file may be in any order. _des_key_str_ is the string that is used to encrypt the message. There should be at least one space between the number and the key. The first key is the default key that is used if you do not specify any key argument to DES_ENCRYPT().\n\nYou can tell MariaDB to read new key values from the key file with the FLUSH DES_KEY_FILE` statement. This requires the RELOAD privilege.\n\nOne benefit of having a set of default keys is that it gives applications a way to check for the existence of encrypted column values, without giving the end user the right to decrypt those values.\n\nExamples\n--------\n\nSELECT customer_address FROM customer_table \n   WHERE crypted_credit_card = DES_ENCRYPT('credit_card_number');\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/des_encrypt