Declaration
ENCRYPT(str[,salt])
Description
The ENCRYPT() function uses the Unix crypt() function to encrypt the str parameter and returns a binary string. The salt parameter must be a string of at least two characters; otherwise, the result is NULL. If the salt parameter is not specified, a random value is used.
Because system calls require a zero-byte-terminated string, it is not recommended to use ENCRYPT() with multibyte character sets such as UCS-2, UTF-16, UTF-16LE, or UTF-32.
If the system does not support crypt(), ENCRYPT() always returns NULL.
Examples
obclient> SELECT ENCRYPT('hello');
+------------------+
| ENCRYPT('hello') |
+------------------+
| XROflfjMAx1GA |
+------------------+
1 row in set