Random
Crypto safe pseudo-random value generation
Table of Contents
Methods
- generateRandomBytes() : string
- Generates cryptographic secure pseudo-random bytes
- generateRandomHexString() : string
- Generates cryptographic secure pseudo-random hex string
- generateRandomInteger() : int
- Generates cryptographic secure pseudo-random integers
- generateRandomPassword() : string
- Generates cryptographic secure pseudo-random password based on given password rules
- generateRandomBase64String() : string
- Generates cryptographic secure pseudo-random base64 string
- shuffleBytes() : string
- Get a byte-wise permutation of a string.
Methods
generateRandomBytes()
Generates cryptographic secure pseudo-random bytes
public
generateRandomBytes(int $length) : string
Parameters
- $length : int
Return values
stringgenerateRandomHexString()
Generates cryptographic secure pseudo-random hex string
public
generateRandomHexString(int $length) : string
Parameters
- $length : int
Return values
stringgenerateRandomInteger()
Generates cryptographic secure pseudo-random integers
public
generateRandomInteger(int $min, int $max) : int
Parameters
- $min : int
- $max : int
Return values
intgenerateRandomPassword()
Generates cryptographic secure pseudo-random password based on given password rules
public
generateRandomPassword(array<string|int, mixed> $passwordRules) : string
Parameters
- $passwordRules : array<string|int, mixed>
Only to be used within TYPO3. Might change in the future.
Return values
stringgenerateRandomBase64String()
Generates cryptographic secure pseudo-random base64 string
protected
generateRandomBase64String(int $length) : string
Parameters
- $length : int
Return values
stringshuffleBytes()
Get a byte-wise permutation of a string.
protected
shuffleBytes(string $bytes) : string
- local polyfill for
Random\Randomizer::shuffleBytes(string $bytes)
- inspired by https://github.com/php/php-src/blob/PHP-8.2.29/ext/standard/string.c#L5730-L5740
Parameters
- $bytes : string