MediaWiki  1.27.2
MWCryptHash Class Reference

Static Public Member Functions

static hash ($data, $raw=true)
 Generate an acceptably unstable one-way-hash of some text making use of the best hash algorithm that we have available. More...
 
static hashAlgo ()
 Decide on the best acceptable hash algorithm we have available for hash() More...
 
static hashLength ($raw=true)
 Return the byte-length output of the hash algorithm we are using in self::hash and self::hmac. More...
 
static hmac ($data, $key, $raw=true)
 Generate an acceptably unstable one-way-hmac of some text making use of the best hash algorithm that we have available. More...
 

Static Public Attributes

static false
 

Static Protected Attributes

static $algo = null
 The hash algorithm being used. More...
 
static $hashLength
 The number of bytes outputted by the hash algorithm. More...
 

Detailed Description

Definition at line 26 of file MWCryptHash.php.

Member Function Documentation

static MWCryptHash::hash (   $data,
  $raw = true 
)
static

Generate an acceptably unstable one-way-hash of some text making use of the best hash algorithm that we have available.

Parameters
string$data
bool$rawTrue to return binary data, false to return it hex-encoded
Returns
string A hash of the data

Definition at line 94 of file MWCryptHash.php.

Referenced by MWCryptRand\driftHash(), MWCryptRand\randomState(), and MWCryptHashTest\testHash().

static MWCryptHash::hashAlgo ( )
static

Decide on the best acceptable hash algorithm we have available for hash()

Returns
string A hash algorithm

Definition at line 44 of file MWCryptHash.php.

References as, and wfDebug().

Referenced by MWCryptHashTest\testHash(), MWCryptHashTest\testHashLength(), and MWCryptHashTest\testHmac().

static MWCryptHash::hashLength (   $raw = true)
static

Return the byte-length output of the hash algorithm we are using in self::hash and self::hmac.

Parameters
bool$rawTrue to return the length for binary data, false to return for hex-encoded
Returns
int Number of bytes the hash outputs

Definition at line 77 of file MWCryptHash.php.

Referenced by MWCryptRand\driftHash(), and MWCryptHashTest\testHashLength().

static MWCryptHash::hmac (   $data,
  $key,
  $raw = true 
)
static

Generate an acceptably unstable one-way-hmac of some text making use of the best hash algorithm that we have available.

Parameters
string$data
string$key
bool$rawTrue to return binary data, false to return it hex-encoded
Returns
string An hmac hash of the data + key

Definition at line 107 of file MWCryptHash.php.

References $key.

Referenced by User\getToken(), MediaWiki\Session\SessionProvider\hashToSessionId(), MWCryptRand\realGenerate(), and MWCryptHashTest\testHmac().

Member Data Documentation

MWCryptHash::$algo = null
staticprotected

The hash algorithm being used.

Definition at line 30 of file MWCryptHash.php.

MWCryptHash::$hashLength
staticprotected
Initial value:
= [
true => null

The number of bytes outputted by the hash algorithm.

Definition at line 35 of file MWCryptHash.php.

MWCryptHash::false
static
Initial value:
=> null,
]

Definition at line 37 of file MWCryptHash.php.


The documentation for this class was generated from the following file: