diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index e21d9c749a1..150a3bd3feb 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -79,9 +79,12 @@ function dol_hash($chain,$type=0) { global $conf; + // Salt value + if (! empty($conf->global->MAIN_SECURITY_SALT)) $chain=$conf->global->MAIN_SECURITY_SALT.$chain; + if ($type == 1) return sha1($chain); else if ($type == 2) return sha1(md5($chain)); - else return md5((empty($conf->global->MAIN_SECURITY_SALT)?'':$conf->global->MAIN_SECURITY_SALT).$chain); + else return md5($chain); }