From 052c6bf39df0326edab2b18a27165c863fdd4f06 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Mon, 25 Feb 2008 20:54:11 +0000 Subject: [PATCH] code cleanup --- lam/lib/account.inc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 1c18c658..397805d5 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -197,20 +197,15 @@ function pwd_hash($password, $enabled = true, $hashType = 'SSHA') { case 'SHA': $hash = "{SHA}" . base64_encode(hex2bin(sha1($password))); break; - case 'SSHA': - $salt0 = substr(pack("h*", md5($rand)), 0, 8); - $salt = substr(pack("H*", sha1($salt0 . $password)), 0, 4); - $hash = "{SSHA}" . base64_encode(hex2bin(sha1($password . $salt)) . $salt); - break; case 'PLAIN': $hash = $password; break; - // use SSHA if the setting is invalid - default: + case 'SSHA': + default: // use SSHA if the setting is invalid $salt0 = substr(pack("h*", md5($rand)), 0, 8); $salt = substr(pack("H*", sha1($salt0 . $password)), 0, 4); $hash = "{SSHA}" . base64_encode(hex2bin(sha1($password . $salt)) . $salt); - break; + break; } // enable/disable password if (! $enabled) return pwd_disable($hash);