当前位置: 首页>>代码示例>>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;未经允许,请勿转载。