Changeset 19986 for branches/version-2_5-dev/data/class/util/SC_Utils.php
- Timestamp:
- 2011/01/19 19:47:07 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/util/SC_Utils.php
r19972 r19986 2247 2247 return true; 2248 2248 } 2249 2250 /** 2251 * パスワードのハッシュ化 2252 * 2253 * @param string $str 暗号化したい文言 2254 * @param string $salt salt 2255 * @return string ハッシュ暗号化された文字列 2256 */ 2257 function sfGetHashString($str, $salt) { 2258 $res = ''; 2259 if ($salt == '') { 2260 $salt = AUTH_MAGIC; 2261 } 2262 if ( AUTH_TYPE == 'PLAIN') { 2263 $res = $str; 2264 } else { 2265 $res = hash_hmac(PASSWORD_HASH_ALGOS, $str . ":" . AUTH_MAGIC, $salt); 2266 } 2267 return $res; 2268 } 2269 2270 /** 2271 * パスワード文字列のハッシュ一致判定 2272 * 2273 * @param string $pass 確認したいパスワード文字列 2274 * @param string $hashpass 確認したいパスワードハッシュ文字列 2275 * @param string $salt salt 2276 * @return boolean 一致判定 2277 */ 2278 function sfIsMatchHashPassword($pass, $hashpass, $salt) { 2279 $res = false; 2280 if ($hashpass != '') { 2281 if (AUTH_TYPE == 'PLAIN') { 2282 if($pass === $hashpass) { 2283 $res = true; 2284 } 2285 } else { 2286 $hash = SC_Utils_Ex::sfGetHashString($pass, $salt); 2287 if($hash === $hashpass) { 2288 $res = true; 2289 } 2290 } 2291 } 2292 return $res; 2293 } 2294 2295 2249 2296 } 2250 2297 ?>
Note: See TracChangeset
for help on using the changeset viewer.
