Cartalyst\Sentinel\Hashing\CallbackHasher::check PHP Method

check() public method

{@inheritDoc}
public check ( $value, $hashedValue )
    public function check($value, $hashedValue)
    {
        $callback = $this->check;
        return $callback($value, $hashedValue);
    }

Usage Example

Beispiel #1
0
 public function testSymbolsValue()
 {
     // Never use this hashing strategy!
     $hash = function ($value) {
         return strrev($value);
     };
     $check = function ($value, $hashedValue) {
         return strrev($value) === $hashedValue;
     };
     $hasher = new CallbackHasher($hash, $check);
     $hashedValue = $hasher->hash('!"#$%^&*()-_,./:;<=>?@[]{}`~|');
     $this->assertTrue($hashedValue !== '!"#$%^&*()-_,./:;<=>?@[]{}`~|');
     $this->assertTrue($hasher->check('!"#$%^&*()-_,./:;<=>?@[]{}`~|', $hashedValue));
 }