MediaWiki REL1_31
|
Static Public Member Functions | |
static | generate ( $bytes, $forceStrong=false) |
Generate a run of (ideally) cryptographically random data and return it in raw binary form. | |
static | generateHex ( $chars, $forceStrong=false) |
Generate a run of (ideally) cryptographically random data and return it in hexadecimal string format. | |
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. | |
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 BcryptPassword\crypt(), EncryptedPassword\crypt(), Pbkdf2Password\crypt(), OATHAuthKey\newFromRandom(), OATHAuthKey\regenerateScratchTokens(), OATHAuthUtils\seal(), 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(), SpecialPage\checkLoginSecurityLevel(), User\confirmationToken(), MWSaltedPassword\crypt(), Installer\doGenerateKeys(), PasswordFactory\generateRandomPasswordString(), MediaWiki\Session\SessionManager\generateSessionId(), WikiEditorHooks\getEditingStatsId(), Pingback\getOrCreatePingbackId(), 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().