Crypt::randomBytesBase64

public static Crypt::randomBytesBase64($count = 32)

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 The base64 encoded result will have a length of up to 4 * $count.

See also

\Drupal\Component\Utility\Crypt::randomBytes()

File

core/lib/Drupal/Component/Utility/Crypt.php, line 130

Class

Crypt
Utility class for cryptographically-secure string handling routines.

Namespace

Drupal\Component\Utility

Code

public static function randomBytesBase64($count = 32) {
  return str_replace(['+', '/', '='], ['-', '_', ''], base64_encode(static::randomBytes($count)));
}
doc_Drupal
2016-10-29 08:59:10
Comments
Leave a Comment

Please login to continue.