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.

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

... See full list

File

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