You are here

function drupal_random_key in Drupal 6

Same name and namespace in other branches
  1. 7 includes/bootstrap.inc \drupal_random_key()

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.

5 calls to drupal_random_key()
drupal_get_form in includes/form.inc
Retrieves a form from a constructor function, or from the cache if the form was built in a previous page-load. The form is then passed on for processing, after and rendered for display if necessary.
drupal_get_private_key in includes/common.inc
Ensure the private key variable used to generate tokens is set.
drupal_rebuild_form in includes/form.inc
Retrieves a form, caches it and processes it with an empty $_POST.
form_get_cache in includes/form.inc
Fetch a form from cache.
user_pass_rehash in modules/user/user.module

File

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