1.20.x 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
- includes/
common.inc, line 5897 - 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;
}