ParagonIE_Sodium_Core_Curve25519::ge_sub() – Subtract two group elements.

You appear to be a bot. Output may be restricted

Description

Subtract two group elements.

r = p – q

Usage

$ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 = ParagonIE_Sodium_Core_Curve25519::ge_sub( $p, $q );

Parameters

$p
( ParagonIE_Sodium_Core_Curve25519_Ge_P3 ) required
$q
( ParagonIE_Sodium_Core_Curve25519_Ge_Cached ) required

Returns

ParagonIE_Sodium_Core_Curve25519_Ge_P1p1

Source

File name: wordpress/wp-includes/sodium_compat/src/Core/Curve25519.php
Lines:

1 to 20 of 20
    public static function ge_sub(
        ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p,
        ParagonIE_Sodium_Core_Curve25519_Ge_Cached $q
    ) {
        $r = new ParagonIE_Sodium_Core_Curve25519_Ge_P1p1();

        $r->X = self::fe_add($p->Y, $p->X);
        $r->Y = self::fe_sub($p->Y, $p->X);
        $r->Z = self::fe_mul($r->X, $q->YminusX);
        $r->Y = self::fe_mul($r->Y, $q->YplusX);
        $r->T = self::fe_mul($q->T2d, $p->T);
        $r->X = self::fe_mul($p->Z, $q->Z);
        $t0 = self::fe_add($r->X, $r->X);
        $r->X = self::fe_sub($r->Z, $r->Y);
        $r->Y = self::fe_add($r->Z, $r->Y);
        $r->Z = self::fe_sub($t0, $r->T);
        $r->T = self::fe_add($t0, $r->T);

        return $r;
    }
 

 View on GitHub View on Trac