Skip navigation
Help

drupal_get_hash_salt

7 common.inc drupal_get_hash_salt()

Get a salt useful for hardening against SQL injection.

Return value

A salt based on information in settings.php, not in the database.

3 calls to drupal_get_hash_salt()

File

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

Code

function drupal_get_hash_salt() {
  global $drupal_hash_salt, $databases;
  // If the $drupal_hash_salt variable is empty, a hash of the serialized
  // database credentials is used as a fallback salt.
  return empty($drupal_hash_salt) ? hash('sha256', serialize($databases)) : $drupal_hash_salt;
}