From e5fd19ffc005b1a935017028eb801e8283b96dbd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Nov 2013 10:45:43 +0100 Subject: [PATCH] Add option to salt hash passwords --- htdocs/core/lib/security.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 58bd4371b4c..e21d9c749a1 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -77,9 +77,11 @@ function dol_decode($chain) */ function dol_hash($chain,$type=0) { + global $conf; + if ($type == 1) return sha1($chain); else if ($type == 2) return sha1(md5($chain)); - else return md5($chain); + else return md5((empty($conf->global->MAIN_SECURITY_SALT)?'':$conf->global->MAIN_SECURITY_SALT).$chain); }