Documentation

Crypto::RandomBase64

Function

string Crypto::RandomBase64(int length, bool url = false)

Generates cryptographically secure random bytes and returns its base64 string.

int length

The number of bytes to generate. Note that this is the length of the encoded bytes, not the length of the base64 string.

bool url

Whether to use URL-encoded unpadded base64 encoding or not.

Returns string