public static function ParagonIE_Sodium_Core32_Curve25519::fe_cmov in Automatic Updates 7
Same name and namespace in other branches
- 8 vendor/paragonie/sodium_compat/src/Core32/Curve25519.php \ParagonIE_Sodium_Core32_Curve25519::fe_cmov()
Constant-time conditional move.
@internal You should not use this directly from another application
@psalm-suppress MixedAssignment @psalm-suppress MixedMethodCall
Parameters
ParagonIE_Sodium_Core32_Curve25519_Fe $f:
ParagonIE_Sodium_Core32_Curve25519_Fe $g:
int $b:
Return value
ParagonIE_Sodium_Core32_Curve25519_Fe
Throws
SodiumException
TypeError
1 call to ParagonIE_Sodium_Core32_Curve25519::fe_cmov()
- ParagonIE_Sodium_Core32_Curve25519::cmov in vendor/
paragonie/ sodium_compat/ src/ Core32/ Curve25519.php - Conditional move
File
- vendor/
paragonie/ sodium_compat/ src/ Core32/ Curve25519.php, line 111
Class
- ParagonIE_Sodium_Core32_Curve25519
- Class ParagonIE_Sodium_Core32_Curve25519
Code
public static function fe_cmov(ParagonIE_Sodium_Core32_Curve25519_Fe $f, ParagonIE_Sodium_Core32_Curve25519_Fe $g, $b = 0) {
/** @var array<int, ParagonIE_Sodium_Core32_Int32> $h */
$h = array();
for ($i = 0; $i < 10; ++$i) {
if (!$f[$i] instanceof ParagonIE_Sodium_Core32_Int32) {
throw new TypeError('Expected Int32');
}
if (!$g[$i] instanceof ParagonIE_Sodium_Core32_Int32) {
throw new TypeError('Expected Int32');
}
$h[$i] = $f[$i]
->xorInt32($f[$i]
->xorInt32($g[$i])
->mask($b));
}
/** @var array<int, ParagonIE_Sodium_Core32_Int32> $h */
return ParagonIE_Sodium_Core32_Curve25519_Fe::fromArray($h);
}