ParagonIE_Sodium_Crypto32::scalarmult_throw_if_zero() protected WP 1.0
This throws an Error if a zero public key was passed to the function.
{} It's a method of the class: ParagonIE_Sodium_Crypto32{}
No Hooks.
Return
null
. Null. Nothing.
Usage
$result = ParagonIE_Sodium_Crypto32::scalarmult_throw_if_zero( $q );
- $q(string) (required)
- -
Code of ParagonIE_Sodium_Crypto32::scalarmult_throw_if_zero() ParagonIE Sodium Crypto32::scalarmult throw if zero WP 5.7
protected static function scalarmult_throw_if_zero($q)
{
$d = 0;
for ($i = 0; $i < self::box_curve25519xsalsa20poly1305_SECRETKEYBYTES; ++$i) {
$d |= ParagonIE_Sodium_Core32_Util::chrToInt($q[$i]);
}
/* branch-free variant of === 0 */
if (-(1 & (($d - 1) >> 8))) {
throw new SodiumException('Zero public key is not allowed');
}
}