Redaxscript\Hash::validate PHP Метод

validate() публичный Метод

validate raw again hash
С версии: 2.6.0
public validate ( string $raw = null, string $hash = null ) : boolean
$raw string plain raw
$hash string salted hash
Результат boolean
    public function validate($raw = null, $hash = null)
    {
        return function_exists('password_hash') ? password_verify($raw, $hash) : $hash === hash('sha512', $raw . $this->_config->get('salt'));
    }

Usage Example

Пример #1
0
 /**
  * benchValidate
  *
  * @since 3.0.0
  *
  * @param array $parameterArray
  *
  * @ParamProviders({"providerHash"})
  */
 public function benchValidate($parameterArray = [])
 {
     /* setup */
     $hash = new Hash($this->_config);
     $hash->init($parameterArray[0]);
     /* bench */
     $hash->validate($parameterArray[0], function_exists('password_verify') ? $parameterArray[1][0][1] : $parameterArray[1][1]);
 }
All Usage Examples Of Redaxscript\Hash::validate