public static function Crypt::randomBytesBase64 in Service Container 7.2
Same name and namespace in other branches
- 7 lib/Drupal/Component/Utility/Crypt.php \Drupal\Component\Utility\Crypt::randomBytesBase64()
Returns a URL-safe, base64 encoded string of highly randomized bytes.
Parameters
$byte_count: The number of random bytes to fetch and base64 encode.
Return value
string The base64 encoded result will have a length of up to 4 * $byte_count.
See also
\Drupal\Component\Utility\Crypt::randomBytes()
1 call to Crypt::randomBytesBase64()
- Html::getUniqueId in lib/
Drupal/ Component/ Utility/ Html.php - Prepares a string for use as a valid HTML ID and guarantees uniqueness.
File
- lib/
Drupal/ Component/ Utility/ Crypt.php, line 189 - Contains \Drupal\Component\Utility\Crypt.
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(static::randomBytes($count)));
}