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

check() public method

{@inheritDoc}
public check ( $value, $hashedValue )
    public function check($value, $hashedValue)
    {
        $salt = substr($hashedValue, 0, $this->saltLength);
        return $this->slowEquals($salt . hash('sha256', $salt . $value), $hashedValue);
    }

Usage Example

コード例 #1
0
 public function testSymbolsValue()
 {
     $hasher = new Sha256Hasher();
     $hashedValue = $hasher->hash('!"#$%^&*()-_,./:;<=>?@[]{}`~|');
     $this->assertTrue($hashedValue !== '!"#$%^&*()-_,./:;<=>?@[]{}`~|');
     $this->assertTrue($hasher->check('!"#$%^&*()-_,./:;<=>?@[]{}`~|', $hashedValue));
 }
Sha256Hasher