protected function TfaBasicRecoveryCodeSetup::generateBlock in TFA Basic plugins 7
Generate block of random digits.
Parameters
int $length:
Return value
string
1 call to TfaBasicRecoveryCodeSetup::generateBlock()
- TfaBasicRecoveryCodeSetup::generate in includes/
tfa_recovery.inc - Overide TfaBasePlugin::generate().
File
- includes/
tfa_recovery.inc, line 217 - class for TFA Basic
Class
- TfaBasicRecoveryCodeSetup
- Class TfaBasicRecoveryCode
Code
protected function generateBlock($length) {
$block = '';
do {
$block .= ord(drupal_random_bytes(1));
} while (strlen($block) <= $length);
return substr($block, 0, $length);
}