Encoding & cryptographyReference
crypt.generatebytes
Generate random bytes and return them as Base64.
Details#
Generate random bytes and return them as Base64. Base64 text representing size bytes; 0 returns an empty string.
Signature#
crypt.generatebytes(size: number): stringParameters#
| Parameter | Type | Description |
|---|---|---|
size | number | Integer byte count from 0 to 1048576. |
Returns#
Base64 text representing size bytes; 0 returns an empty string.
Examples#
Local example
local encoded = crypt.generatebytes(16)
print(#crypt.base64decode(encoded)) -- 16