Same name and namespace in other branches
  1. 4.7.x includes/common.inc \drupal_get_private_key()
  2. 5.x includes/common.inc \drupal_get_private_key()
  3. 6.x includes/common.inc \drupal_get_private_key()
  4. 7.x includes/common.inc \drupal_get_private_key()

Ensure the private key variable used to generate tokens is set.

Return value

The private key

Related topics

1 call to drupal_get_private_key()
drupal_get_token in includes/common.inc
Generate a token based on $value, the current user session and private key.

File

includes/common.inc, line 933
Common functions that many Drupal modules will need to reference.

Code

function drupal_get_private_key() {
  if (!($key = variable_get('drupal_private_key', 0))) {
    $key = mt_rand();
    variable_set('drupal_private_key', $key);
  }
  return $key;
}