Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RANDOM_BYTES or CRYPT_GEN_RANDOM equivalent in MariaDB

Tags:

random

mariadb

Question

Is any alternatives of MySQL RANDOM_BYTES(len) or MSSQL CRYPT_GEN_RANDOM(len) available in MariaDB?

I read through their documentation, but I only found is rand(len), which is not cryptographically secure in generating random bytes.

Issues

Currently released version of MariaDB (10.3) does not support RANDOM_BYTES(len) according to this documentation https://mariadb.com/kb/en/library/function-differences-between-mariadb-103-and-mysql-57/

Limitation

If possible, keep the code within the MariaDB, and I don't want to rely on PHP or any other external functions for security reasons.

like image 975
FrozenFire Avatar asked Nov 05 '18 06:11

FrozenFire


1 Answers

It seems RANDOM_BYTES(length) is available since 10.10.0 (preview release) Check the documentation.

like image 93
Alejandro Duarte Avatar answered Jan 04 '23 00:01

Alejandro Duarte