function drupal_random_key

drupal_random_key($byte_count = 32)

Returns a URL-safe, base64 encoded string of highly randomized bytes (over the full 8-bit range).

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.

File

includes/bootstrap.inc, line 2207
Functions that need to be loaded on every Drupal request.

Code

function drupal_random_key($byte_count = 32) {
  return drupal_base64_encode(drupal_random_bytes($byte_count));
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!bootstrap.inc/function/drupal_random_key/7.x