function drupal_random_key

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


$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.

12 calls to drupal_random_key()
drupal_get_private_key in drupal/includes/
Ensures the private key variable used to generate tokens is set.
drupal_prepare_form in drupal/includes/
Prepares a structured form array.
drupal_rebuild_form in drupal/includes/
Constructs a new $form from the information in $form_state.
drupal_session_initialize in drupal/includes/
Initializes the session handler, starting a session if needed.
drupal_session_regenerate in drupal/includes/
Called when an anonymous user becomes authenticated or vice-versa.

... See full list


drupal/includes/, line 2222
Functions that need to be loaded on every Drupal request.


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