public static function Crypt::randomBytesBase64 in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Component/Utility/Crypt.php \Drupal\Component\Utility\Crypt::randomBytesBase64()
- 10 core/lib/Drupal/Component/Utility/Crypt.php \Drupal\Component\Utility\Crypt::randomBytesBase64()
Returns a URL-safe, base64 encoded string of highly randomized bytes.
Parameters
$count: The number of random bytes to fetch and base64 encode.
Return value
string A base-64 encoded string, with + replaced with -, / with _ and any = padding characters removed.
See also
\Drupal\Component\Utility\Crypt::randomBytes()
32 calls to Crypt::randomBytesBase64()
- BigPipe::sendNoJsPlaceholders in core/
modules/ big_pipe/ src/ Render/ BigPipe.php - Sends no-JS BigPipe placeholders' replacements as embedded HTML responses.
- BigPipe::sendPreBody in core/
modules/ big_pipe/ src/ Render/ BigPipe.php - Sends everything until just before </body>.
- CsrfTokenGenerator::get in core/
lib/ Drupal/ Core/ Access/ CsrfTokenGenerator.php - Generates a token based on $value, the user session, and the private key.
- CsrfTokenGeneratorTest::setupDefaultExpectations in core/
tests/ Drupal/ Tests/ Core/ Access/ CsrfTokenGeneratorTest.php - Set up default expectations on the mocks.
- CsrfTokenGeneratorTest::testGenerateSeedOnGet in core/
tests/ Drupal/ Tests/ Core/ Access/ CsrfTokenGeneratorTest.php - Tests that a new token seed is generated upon first use.
File
- core/
lib/ Drupal/ Component/ Utility/ Crypt.php, line 116
Class
- Crypt
- Utility class for cryptographically-secure string handling routines.
Namespace
Drupal\Component\UtilityCode
public static function randomBytesBase64($count = 32) {
return str_replace([
'+',
'/',
'=',
], [
'-',
'_',
'',
], base64_encode(random_bytes($count)));
}