當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SecurityUtil::checkSaltedHash方法代碼示例

本文整理匯總了PHP中SecurityUtil::checkSaltedHash方法的典型用法代碼示例。如果您正苦於以下問題:PHP SecurityUtil::checkSaltedHash方法的具體用法?PHP SecurityUtil::checkSaltedHash怎麽用?PHP SecurityUtil::checkSaltedHash使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SecurityUtil的用法示例。


在下文中一共展示了SecurityUtil::checkSaltedHash方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: passwordsMatch

 /**
  * Compare a password-like code to a hashed value, to determine if they match.
  *
  * Note that this is not limited only to use for user login passwords, but can be used where ever a human-readable
  * password-like code is needed.
  *
  * @param string $unhashedPassword The password-like code entered by the user.
  * @param string $hashedPassword   The hashed password-like code that the entered password-like code is to be compared to.
  *
  * @return bool True if the $unhashedPassword matches the $hashedPassword with the given hashing method; false if they do not
  *                  match, or if there was an error (such as an empty password or invalid code).
  */
 public static function passwordsMatch($unhashedPassword, $hashedPassword)
 {
     $passwordsMatch = false;
     if (!isset($unhashedPassword) || !is_string($unhashedPassword) || empty($unhashedPassword)) {
         return LogUtil::registerArgsError();
     }
     if (!isset($hashedPassword) || !is_string($hashedPassword) || empty($hashedPassword) || strpos($hashedPassword, UsersConstant::SALT_DELIM) === false) {
         return LogUtil::registerArgsError();
     }
     $passwordsMatch = SecurityUtil::checkSaltedHash($unhashedPassword, $hashedPassword, self::getPasswordHashMethods(true), UsersConstant::SALT_DELIM);
     return $passwordsMatch;
 }
開發者ID:rtznprmpftl,項目名稱:Zikulacore,代碼行數:24,代碼來源:UserUtil.php

示例2: passwordsMatch

 /**
  * Compare a password-like code to a hashed value, to determine if they match.
  *
  * Note that this is not limited only to use for user login passwords, but can be used where ever a human-readable
  * password-like code is needed.
  *
  * @param string $unhashedPassword The password-like code entered by the user.
  * @param string $hashedPassword   The hashed password-like code that the entered password-like code is to be compared to.
  *
  * @return bool True if the $unhashedPassword matches the $hashedPassword with the given hashing method; false if they do not
  *                  match, or if there was an error (such as an empty password or invalid code).
  */
 public static function passwordsMatch($unhashedPassword, $hashedPassword)
 {
     $passwordsMatch = false;
     if (!isset($unhashedPassword) || !is_string($unhashedPassword) || empty($unhashedPassword)) {
         throw new \InvalidArgumentException(__('Invalid arguments array received'));
     }
     if (!isset($hashedPassword) || !is_string($hashedPassword) || empty($hashedPassword) || strpos($hashedPassword, UsersConstant::SALT_DELIM) === false) {
         throw new \InvalidArgumentException(__('Invalid arguments array received'));
     }
     $passwordsMatch = SecurityUtil::checkSaltedHash($unhashedPassword, $hashedPassword, self::getPasswordHashMethods(true), UsersConstant::SALT_DELIM);
     return $passwordsMatch;
 }
開發者ID:rmaiwald,項目名稱:core,代碼行數:24,代碼來源:UserUtil.php


注:本文中的SecurityUtil::checkSaltedHash方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。