From 32983b79eebaff8250db543ba5e665609f58b4d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Nov 2013 10:47:24 +0100 Subject: [PATCH] Sec: Add option to salt password --- htdocs/core/lib/security.lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); }