function drupal_random_key

7.x bootstrap.inc drupal_random_key($byte_count = 32)
6.x bootstrap.inc 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.

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

... See full list

File

drupal/includes/bootstrap.inc, line 1962
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));
}