vBulletin v6.0.4

vB_Utility_Random
in package
Uses vB_Utility_Trait_NoSerialize

Table of Contents

Methods

__serialize()  : array<string|int, mixed>
__sleep()  : array<string|int, mixed>
__unserialize()  : void
__wakeup()  : void
alphanumeric()  : string
Generates a random string of alphanumeric characters
hex()  : mixed
Approximation of old fetch_random_string() function in terms of output set, not distribution.
nonsecureAlphanumeric()  : string
Generates a random string of alphanumeric characters. Exactly like alphanumeric but uses a random number generator that is not cryptographically secure.
nonsecureString()  : mixed
This is the same as string, but uses a random generator that is not cryptographically secure
string()  : mixed
Generate a randon string from a given alphabet
vbhash()  : string
vBulletin's hash fetcher, note this may change from a-f0-9 to a-z0-9 in future.

Methods

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__sleep()

public __sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>

__unserialize()

public __unserialize(mixed $serialized) : void
Parameters
$serialized : mixed

alphanumeric()

Generates a random string of alphanumeric characters

public alphanumeric(int $length) : string

Calls the string function with an alphabet of lower case and upper case latin characters and numbers

Parameters
$length : int
Return values
string

-- random string of length $length

hex()

Approximation of old fetch_random_string() function in terms of output set, not distribution.

public hex([mixed $length = 32 ]) : mixed
Parameters
$length : mixed = 32

nonsecureAlphanumeric()

Generates a random string of alphanumeric characters. Exactly like alphanumeric but uses a random number generator that is not cryptographically secure.

public nonsecureAlphanumeric(int $length) : string

Calls the nonsecureString function with an alphabet of lower case and upper case latin characters and numbers

Parameters
$length : int
Return values
string

-- random string of length $length

nonsecureString()

This is the same as string, but uses a random generator that is not cryptographically secure

public nonsecureString(string $characters, mixed $length) : mixed

This function is faster than string and does not use up "entropy" in the secure random number generater. Therefore it's preferred for uses that don't require cryptographic security (for example, unique identifiers that are entirely internal and therefore can't be guessed/spoofed or situations where we validate security in other ways -- such as were the id will only be accepted from a validated user account where we've already told the user what the id is).

Parameters
$characters : string

-- the alphabet of characters to use @param integer $length

@return string -- random string of length $length

$length : mixed

string()

Generate a randon string from a given alphabet

public string(string $characters, mixed $length) : mixed
Parameters
$characters : string

-- the alphabet of characters to use @param integer $length

@return string -- random string of length $length

$length : mixed

vbhash()

vBulletin's hash fetcher, note this may change from a-f0-9 to a-z0-9 in future.

public vbhash([mixed $length = 32 ]) : string

Note that the caller should not depend on format of the returned string other then it should be printable. If a hex string is specificially needed, call the hex function.

Parameters
$length : mixed = 32
Return values
string

        
On this page

Search results