class RandomGenerator

Generates entropy values based on strongest available methods (mcrypt_create_iv(), openssl_random_pseudo_bytes(), /dev/urandom, COM.CAPICOM.Utilities.1, mt_rand()).

Chosen method depends on operating system and PHP version.

Methods

string
generateEntropy()

Note: Returned values are not guaranteed to be crypto-safe, depending on the used retrieval method.

String
randomToken(String $algorithm = 'whirlpool')

Generates a random token that can be used for session IDs, CSRF tokens etc., based on hash algorithms.

generateHash($algorithm = 'whirlpool') deprecated

No description

Details

at line 19
string generateEntropy()

Note: Returned values are not guaranteed to be crypto-safe, depending on the used retrieval method.

Return Value

string Returns a random series of bytes

at line 77
String randomToken(String $algorithm = 'whirlpool')

Generates a random token that can be used for session IDs, CSRF tokens etc., based on hash algorithms.

If you are using it as a password equivalent (e.g. autologin token) do NOT store it in the database as a plain text but encrypt it with Member::encryptWithUserSettings.

Parameters

String $algorithm Any identifier listed in hash_algos() (Default: whirlpool)

Return Value

String Returned length will depend on the used $algorithm

at line 84
generateHash($algorithm = 'whirlpool') deprecated

deprecated

Parameters

$algorithm