forked from Wavyzz/dolibarr
Fix: A little clean of dol_hash usage.
This commit is contained in:
@@ -70,11 +70,11 @@ function dol_decode($chain)
|
||||
|
||||
/**
|
||||
* Returns a hash of a string.
|
||||
* If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function (md5 by default)
|
||||
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt
|
||||
* If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function.
|
||||
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt.
|
||||
*
|
||||
* @param string $chain String to hash
|
||||
* @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5)
|
||||
* @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5)
|
||||
* @return string Hash of string
|
||||
*/
|
||||
function dol_hash($chain,$type=0)
|
||||
@@ -86,9 +86,12 @@ function dol_hash($chain,$type=0)
|
||||
|
||||
if ($type == 1) return sha1($chain);
|
||||
else if ($type == 2) return sha1(md5($chain));
|
||||
else if ($type == 3) return md5($chain);
|
||||
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1') return sha1($chain);
|
||||
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1md5') return sha1(md5($chain));
|
||||
else return md5($chain);
|
||||
|
||||
// No enconding defined
|
||||
return md5($chain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user