top of page
MySQL:
RANDOM_BYTES
Syntax:
RANDOM_BYTES(len)
This function returns a binary string of len random bytes generated
using the random number generator of the SSL library. Permitted values
of len range from 1 to 1024. For values outside that range, an error
occurs.
RANDOM_BYTES() can be used to provide the initialization vector for the
AES_DECRYPT() and AES_ENCRYPT() functions. For use in that context, len
must be at least 16. Larger values are permitted, but bytes in excess
of 16 are ignored.
RANDOM_BYTES() generates a random value, which makes its result
nondeterministic. Consequently, statements that use this function are
unsafe for statement-based replication.
URL: https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html
Example
bottom of page