Auth_OpenID_CryptUtil
in package
Table of Contents
- constEq() : mixed
- getBytes() : string
- Get the specified number of random bytes.
- randomString() : string
- Produce a string of length random bytes, chosen from chrs. If $chrs is null, the resulting string may contain any characters.
Methods
constEq()
public
static constEq(mixed $s1, mixed $s2) : mixed
Parameters
- $s1 : mixed
- $s2 : mixed
Return values
mixed —getBytes()
Get the specified number of random bytes.
public
static getBytes(int $num_bytes) : string
Attempts to use a cryptographically secure (not predictable)
source of randomness if available. If there is no high-entropy
randomness source available, it will fail. As a last resort,
for non-critical systems, define
Auth_OpenID_RAND_SOURCE as null, and
the code will fall back on a pseudo-random number generator.
Parameters
- $num_bytes : int
-
The length of the return value
Return values
string —$bytes random bytes
randomString()
Produce a string of length random bytes, chosen from chrs. If $chrs is null, the resulting string may contain any characters.
public
static randomString(int $length[, string|null $population = null ]) : string
Parameters
- $length : int
-
The length of the resulting randomly-generated string
- $population : string|null = null
-
A string of characters from which to choose to build the new string
Return values
string —$result A string of randomly-chosen characters from $chrs