if (!
is_resource($fp)) { throw new SodiumException('Could not open input file for reading'
);
} /** @var bool The original value of ParagonIE_Sodium_Compat::$fastMult */
$orig = ParagonIE_Sodium_Compat::
$fastMult;
// Set ParagonIE_Sodium_Compat::$fastMult to true to speed up verification.
ParagonIE_Sodium_Compat::
$fastMult = true;
/** @var ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A */
$A = ParagonIE_Sodium_Core_Ed25519::
ge_frombytes_negate_vartime($publicKey);
$hs =
hash_init('sha512'
);
self::
hash_update($hs, self::
substr($sig, 0, 32
));
self::
hash_update($hs, self::
substr($publicKey, 0, 32
));
/** @var resource $hs */
$hs = self::
updateHashWithFile($hs,
$fp,
$size);
/** @var string $hDigest */
$hDigest =
hash_final($hs, true
);
/** @var string $h */
$h = ParagonIE_Sodium_Core_Ed25519::
sc_reduce($hDigest) . self::
substr($hDigest, 32
);