Ignore:
Timestamp:
2011/01/19 19:47:07 (15 years ago)
Author:
AMUAMU
Message:

#818 (パスワードリマインダの答えのハッシュ暗号化) の解決
#819 (パスワードのハッシュ暗号化の強化) の解決
#335 (パスワードリマインダの改修) の準備修正
#895 (会員登録完了ページのタイトル異常) の解決
#899 (会員登録時にパスワードが正しく登録されない) の解決
#744 (PHP4 互換用途ソースを将来的に切り捨てやすい仕組みづくり) 関連の修正も含む

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/util/SC_Utils.php

    r19972 r19986  
    22472247        return true; 
    22482248    } 
     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 
    22492296} 
    22502297?> 
Note: See TracChangeset for help on using the changeset viewer.