$pieces =
explode('$',
(string) $hash);
$prefix =
implode('$',
array_slice($pieces, 0, 4
));
// Rebuild the expected header.
/** @var int $ops */
$ops =
(int) $opslimit;
/** @var int $mem */
$mem =
(int) $memlimit >> 10;
$encoded = self::CRYPTO_PWHASH_STRPREFIX . 'v=19$m=' .
$mem . ',t=' .
$ops . ',p=1';
// Do they match? If so, we don't need to rehash, so return false.
return !ParagonIE_Sodium_Core_Util::
hashEquals($encoded,
$prefix);
} /**
* @param string $passwd
* @param string $hash
* @return bool
* @throws SodiumException
* @throws TypeError
* @psalm-suppress MixedArgument
*/
public static function crypto_pwhash_str_verify($passwd,
$hash) {