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.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

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 new ParagonIE_Sodium_Core_Curve25519_Fe();    }     /**     * 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()    {        $fe = new ParagonIE_Sodium_Core_Curve25519_Fe();        $fe->e0 = 1;        return $fe;    }     /**     * 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    ) {        return new ParagonIE_Sodium_Core_Curve25519_Fe(            (int)($f->e0 + $g->e0),            (int)($f->e1 + $g->e1),            (int)($f->e2 + $g->e2),            (int)($f->e3 + $g->e3),            (int)($f->e4 + $g->e4),            (int)($f->e5 + $g->e5),            (int)($f->e6 + $g->e6),            (int)($f->e7 + $g->e7),            (int)($f->e8 + $g->e8),            (int)($f->e9 + $g->e9)        );    }     /**     * 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    ) {        $h = new ParagonIE_Sodium_Core_Curve25519_Fe();        $b *= -1;        $x = (($f->e0 ^ $g->e0) & $b); $h->e0 = $f->e0 ^ $x;        $x = (($f->e1 ^ $g->e1) & $b); $h->e1 = $f->e1 ^ $x;        $x = (($f->e2 ^ $g->e2) & $b); $h->e2 = $f->e2 ^ $x;        $x = (($f->e3 ^ $g->e3) & $b); $h->e3 = $f->e3 ^ $x;        $x = (($f->e4 ^ $g->e4) & $b); $h->e4 = $f->e4 ^ $x;

Changelog

Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

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

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 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.