: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @throws SodiumException
public static function scalar_random()
$r = ParagonIE_Sodium_Compat::randombytes_buf(self::SCALAR_BYTES);
$r[self::SCALAR_BYTES - 1] = self::intToChr(
self::chrToInt($r[self::SCALAR_BYTES - 1]) & 0x1f
!self::check_S_lt_L($r) || ParagonIE_Sodium_Compat::is_zero($r)
* @throws SodiumException
public static function scalar_negate($s)
$t_ = self::L . str_repeat("\x00", 32) ;
$s_ = $s . str_repeat("\x00", 32) ;
ParagonIE_Sodium_Compat::sub($t_, $s_);
return self::sc_reduce($t_);
* @throws SodiumException
public static function scalar_add($a, $b)
$a_ = $a . str_repeat("\x00", 32);
$b_ = $b . str_repeat("\x00", 32);
ParagonIE_Sodium_Compat::add($a_, $b_);
return self::sc_reduce($a_);
* @throws SodiumException
public static function scalar_sub($x, $y)
$yn = self::scalar_negate($y);
return self::scalar_add($x, $yn);