This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-22. For the latest, interactive version please visit https://mariadb.com/kb/.

ENCODE

Syntax

ENCODE(str,pass_str)

Description

ENCODE is not considered cryptographically secure, and should not be used for password encryption.

Encrypt str using pass_str as the password. To decrypt the result, use DECODE().

The result is a binary string of the same length as str.

The strength of the encryption is based on how good the random generator is.

It is not recommended to rely on the encryption performed by the ENCODE function. Using a salt value (changed when a password is updated) will improve matters somewhat, but for storing passwords, consider a more cryptographically secure function, such as SHA2().

Examples

ENCODE('not so secret text', CONCAT('random_salt','password'))
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.