drupal_get_private_key

Definition

drupal_get_private_key()
drupal/includes/common.inc, line 1766

Description

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

Return value

The private key

Related topics

Namesort iconDescription
Input validationFunctions to validate user input.

Code

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