1 common.inc backdrop_get_hash_salt()

Gets a salt useful for hardening against SQL injection.

Return value

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

File

core/includes/common.inc, line 5747
Common functions that many Backdrop modules will need to reference.

Code

function backdrop_get_hash_salt() {
  global $databases;
  $hash_salt = settings_get('hash_salt');

  // If the hash_salt setting is empty, a hash of the serialized
  // database credentials is used as a fallback salt.
  return empty($hash_salt) ? hash('sha256', serialize($databases)) : $hash_salt;
}