MediaWiki
1.30.0
|
Static Public Member Functions | |
static | generate ( $bytes, $forceStrong=false) |
Generate a run of (ideally) cryptographically random data and return it in raw binary form. More... | |
static | generateHex ( $chars, $forceStrong=false) |
Generate a run of (ideally) cryptographically random data and return it in hexadecimal string format. More... | |
static | wasStrong () |
Return a boolean indicating whether or not the source used for cryptographic random bytes generation in the previously run generate* call was cryptographically strong. More... | |
Static Protected Member Functions | |
static | singleton () |
Definition at line 29 of file MWCryptRand.php.
|
static |
Generate a run of (ideally) cryptographically random data and return it in raw binary form.
You can use MWCryptRand::wasStrong() if you wish to know if the source used was cryptographically strong.
int | $bytes | The number of bytes of random data to generate |
bool | $forceStrong | Pass true if you want generate to prefer cryptographically strong sources of entropy even if reading from them may steal more entropy from the system than optimal. |
Definition at line 60 of file MWCryptRand.php.
References singleton().
Referenced by EncryptedPassword\crypt(), Pbkdf2Password\crypt(), BcryptPassword\crypt(), MediaWiki\Session\Session\setSecret(), MediaWiki\Session\SessionTest\testSecrets(), and EncryptedPassword\update().
|
static |
Generate a run of (ideally) cryptographically random data and return it in hexadecimal string format.
You can use MWCryptRand::wasStrong() if you wish to know if the source used was cryptographically strong.
int | $chars | The number of hex chars of random data to generate |
bool | $forceStrong | Pass true if you want generate to prefer cryptographically strong sources of entropy even if reading from them may steal more entropy from the system than optimal. |
Definition at line 76 of file MWCryptRand.php.
References singleton().
Referenced by UIDGenerator\__construct(), User\confirmationToken(), MWSaltedPassword\crypt(), Installer\doGenerateKeys(), PasswordFactory\generateRandomPasswordString(), MediaWiki\Session\SessionManager\generateSessionId(), WikiEditorHooks\getEditingStatsId(), Pingback\getOrCreatePingbackId(), MediaWiki\Session\Session\getSecretKeys(), MediaWiki\Session\Session\getToken(), User\getToken(), AuthManagerSpecialPage\handleReauthBeforeExecute(), UIDGenerator\newUUIDv4(), User\resetTokenFromOption(), BotPassword\save(), User\setToken(), ApiRevisionDeleteTest\setUp(), UserTest\testAutoblockCookieInauthentic(), UserTest\testAutoblockCookieInfiniteExpiry(), UserTest\testAutoblockCookies(), and UserTest\testAutoblockCookiesDisabled().
|
staticprotected |
Definition at line 33 of file MWCryptRand.php.
Referenced by generate(), generateHex(), and wasStrong().
|
static |
Return a boolean indicating whether or not the source used for cryptographic random bytes generation in the previously run generate* call was cryptographically strong.
Definition at line 44 of file MWCryptRand.php.
References singleton().
Referenced by Installer\doGenerateKeys().