wppaste
WordPress

ParagonIE_Sodium_Core_Curve25519

Source
wp-includes/sodium_compat/src/Core/Curve25519.php:16
Class ParagonIE_Sodium_Core_Curve25519

Description

Implements Curve25519 core functions

Based on the ref10 curve25519 code provided by libsodium

Compatibility

WordPress
core
  • 6.7.10
  • 6.8.11
  • 6.9.10
  • 7.0.7
  • 7.1.3

Present in every tracked release (6.7.10 to 7.1.3).

Methods · 51

Source code

abstract class ParagonIE_Sodium_Core_Curve25519 extends ParagonIE_Sodium_Core_Curve25519_H{    /**     * Get a field element of size 10 with a value of 0     *     * @internal You should not use this directly from another application     *     * @return ParagonIE_Sodium_Core_Curve25519_Fe     */    public static function fe_0()    {        return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(            array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)        );    }     /**     * Get a field element of size 10 with a value of 1     *     * @internal You should not use this directly from another application     *     * @return ParagonIE_Sodium_Core_Curve25519_Fe     */    public static function fe_1()    {        return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray(            array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0)        );    }     /**     * Add two field elements.     *     * @internal You should not use this directly from another application     *     * @param ParagonIE_Sodium_Core_Curve25519_Fe $f     * @param ParagonIE_Sodium_Core_Curve25519_Fe $g     * @return ParagonIE_Sodium_Core_Curve25519_Fe     * @psalm-suppress MixedAssignment     * @psalm-suppress MixedOperand     */    public static function fe_add(        ParagonIE_Sodium_Core_Curve25519_Fe $f,        ParagonIE_Sodium_Core_Curve25519_Fe $g    ) {        /** @var array<int, int> $arr */        $arr = array();        for ($i = 0; $i < 10; ++$i) {            $arr[$i] = (int) ($f[$i] + $g[$i]);        }        return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray($arr);    }     /**     * Constant-time conditional move.     *     * @internal You should not use this directly from another application     *     * @param ParagonIE_Sodium_Core_Curve25519_Fe $f     * @param ParagonIE_Sodium_Core_Curve25519_Fe $g     * @param int $b     * @return ParagonIE_Sodium_Core_Curve25519_Fe     * @psalm-suppress MixedAssignment     */    public static function fe_cmov(        ParagonIE_Sodium_Core_Curve25519_Fe $f,        ParagonIE_Sodium_Core_Curve25519_Fe $g,        $b = 0    ) {        /** @var array<int, int> $h */        $h = array();        $b *= -1;        for ($i = 0; $i < 10; ++$i) {            $x = (($f[$i] ^ $g[$i]) & $b);            $h[$i] = ($f[$i]) ^ $x;        }        return ParagonIE_Sodium_Core_Curve25519_Fe::fromArray($h);    }     /**

Changelog

Unchanged from 6.7.10 through 7.1.3.

  1. 6.7.10
  2. 6.8.11
  3. 6.9.10
  4. 7.0.7
  5. 7.1.3

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.11 tag, from src/wp-includes/sodium_compat/src/Core/Curve25519.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.