New: add function dol_hash

This commit is contained in:
Regis Houssin
2011-05-03 10:53:44 +00:00
parent 3dbd183e66
commit 8c571546a5
3 changed files with 17 additions and 2 deletions

View File

@@ -558,4 +558,17 @@ function getRandomPassword()
return $generated_password;
}
/**
* Returns a hash of a string
* @param chain String to hash
* @param type Type of hash (0:md5, 1:sha1, 2:sha1+md5)
* @return hash hash of string
*/
function dol_hash($chain,$type=0)
{
if ($type == 1) return sha1($chain);
else if ($type == 2) return sha1(md5($chain));
else return md5($chain);
}
?>