ENCRYPT

2023-12-25 08:49:42  Updated

Syntax

ENCRYPT(str[,salt])

Purpose

ENCRYPT() uses the Unix crypt() function to encrypt the str string and returns a binary string. The value of the salt argument must be a string containing at least two characters; otherwise, this function returns NULL. If you do not specify the salt argument, a random value is used.

System calls require a string ending with zero bytes. Therefore, we recommend that you not use this function with a multi-byte character set such as ucs2, utf16, utf16le, or utf32.

If the system does not support the crypt() function, ENCRYPT() always returns NULL.

Examples

obclient> SELECT ENCRYPT('hello');
+------------------+
| ENCRYPT('hello') |
+------------------+
| XROflfjMAx1GA    |
+------------------+
1 row in set

Contact Us