WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
функция не описана

ParagonIE_Sodium_Core32_Curve25519::ge_double_scalarmult_vartime() public WP 1.0

Это метод класса: ParagonIE_Sodium_Core32_Curve25519{}

Хуков нет.

Возвращает

ParagonIE_Sodium_Core32_Curve25519_Ge_P2.

Использование

$result = ParagonIE_Sodium_Core32_Curve25519::ge_double_scalarmult_vartime(;
$a(строка) (обязательный)
$A(ParagonIE_Sodium_Core32_Curve25519_Ge_P3) (обязательный)
$b(строка) (обязательный)

Код ParagonIE_Sodium_Core32_Curve25519::ge_double_scalarmult_vartime() WP 5.5.1

<?php
public static function ge_double_scalarmult_vartime(
    $a,
    ParagonIE_Sodium_Core32_Curve25519_Ge_P3 $A,
    $b
) {
    /** @var array<int, ParagonIE_Sodium_Core32_Curve25519_Ge_Cached> $Ai */
    $Ai = array();

    static $Bi = array();
    /** @var array<int, ParagonIE_Sodium_Core32_Curve25519_Ge_Precomp> $Bi */
    if (!$Bi) {
        for ($i = 0; $i < 8; ++$i) {
            $Bi[$i] = new ParagonIE_Sodium_Core32_Curve25519_Ge_Precomp(
                ParagonIE_Sodium_Core32_Curve25519_Fe::fromArray(
                    array(
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][0][0]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][0][1]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][0][2]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][0][3]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][0][4]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][0][5]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][0][6]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][0][7]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][0][8]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][0][9])
                    )
                ),
                ParagonIE_Sodium_Core32_Curve25519_Fe::fromArray(
                    array(
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][1][0]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][1][1]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][1][2]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][1][3]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][1][4]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][1][5]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][1][6]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][1][7]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][1][8]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][1][9])
                    )
                ),
                ParagonIE_Sodium_Core32_Curve25519_Fe::fromArray(
                    array(
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][2][0]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][2][1]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][2][2]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][2][3]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][2][4]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][2][5]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][2][6]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][2][7]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][2][8]),
                        ParagonIE_Sodium_Core32_Int32::fromInt(self::$base2[$i][2][9])
                    )
                )
            );
        }
    }

    for ($i = 0; $i < 8; ++$i) {
        $Ai[$i] = new ParagonIE_Sodium_Core32_Curve25519_Ge_Cached(
            self::fe_0(),
            self::fe_0(),
            self::fe_0(),
            self::fe_0()
        );
    }
    /** @var array<int, ParagonIE_Sodium_Core32_Curve25519_Ge_Cached> $Ai */

    # slide(aslide,a);
    # slide(bslide,b);
    /** @var array<int, int> $aslide */
    $aslide = self::slide($a);
    /** @var array<int, int> $bslide */
    $bslide = self::slide($b);

    # ge_p3_to_cached(&Ai[0],A);
    # ge_p3_dbl(&t,A); ge_p1p1_to_p3(&A2,&t);
    $Ai[0] = self::ge_p3_to_cached($A);
    $t = self::ge_p3_dbl($A);
    $A2 = self::ge_p1p1_to_p3($t);

    # ge_add(&t,&A2,&Ai[0]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[1],&u);
    # ge_add(&t,&A2,&Ai[1]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[2],&u);
    # ge_add(&t,&A2,&Ai[2]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[3],&u);
    # ge_add(&t,&A2,&Ai[3]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[4],&u);
    # ge_add(&t,&A2,&Ai[4]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[5],&u);
    # ge_add(&t,&A2,&Ai[5]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[6],&u);
    # ge_add(&t,&A2,&Ai[6]); ge_p1p1_to_p3(&u,&t); ge_p3_to_cached(&Ai[7],&u);
    for ($i = 0; $i < 7; ++$i) {
        $t = self::ge_add($A2, $Ai[$i]);
        $u = self::ge_p1p1_to_p3($t);
        $Ai[$i + 1] = self::ge_p3_to_cached($u);
    }

    # ge_p2_0(r);
    $r = self::ge_p2_0();

    # for (i = 255;i >= 0;--i) {
    #     if (aslide[i] || bslide[i]) break;
    # }
    $i = 255;
    for (; $i >= 0; --$i) {
        if ($aslide[$i] || $bslide[$i]) {
            break;
        }
    }

    # for (;i >= 0;--i) {
    for (; $i >= 0; --$i) {
        # ge_p2_dbl(&t,r);
        $t = self::ge_p2_dbl($r);

        # if (aslide[i] > 0) {
        if ($aslide[$i] > 0) {
            # ge_p1p1_to_p3(&u,&t);
            # ge_add(&t,&u,&Ai[aslide[i]/2]);
            $u = self::ge_p1p1_to_p3($t);
            $t = self::ge_add(
                $u,
                $Ai[(int) floor($aslide[$i] / 2)]
            );
            # } else if (aslide[i] < 0) {
        } elseif ($aslide[$i] < 0) {
            # ge_p1p1_to_p3(&u,&t);
            # ge_sub(&t,&u,&Ai[(-aslide[i])/2]);
            $u = self::ge_p1p1_to_p3($t);
            $t = self::ge_sub(
                $u,
                $Ai[(int) floor(-$aslide[$i] / 2)]
            );
        }
        /** @var array<int, ParagonIE_Sodium_Core32_Curve25519_Ge_Precomp> $Bi */

        # if (bslide[i] > 0) {
        if ($bslide[$i] > 0) {
            # ge_p1p1_to_p3(&u,&t);
            # ge_madd(&t,&u,&Bi[bslide[i]/2]);
            $u = self::ge_p1p1_to_p3($t);
            /** @var int $index */
            $index = (int) floor($bslide[$i] / 2);
            /** @var ParagonIE_Sodium_Core32_Curve25519_Ge_Precomp $thisB */
            $thisB = $Bi[$index];
            $t = self::ge_madd($t, $u, $thisB);
            # } else if (bslide[i] < 0) {
        } elseif ($bslide[$i] < 0) {
            # ge_p1p1_to_p3(&u,&t);
            # ge_msub(&t,&u,&Bi[(-bslide[i])/2]);
            $u = self::ge_p1p1_to_p3($t);

            /** @var int $index */
            $index = (int) floor(-$bslide[$i] / 2);

            /** @var ParagonIE_Sodium_Core32_Curve25519_Ge_Precomp $thisB */
            $thisB = $Bi[$index];
            $t = self::ge_msub($t, $u, $thisB);
        }
        # ge_p1p1_to_p2(r,&t);
        $r = self::ge_p1p1_to_p2($t);
    }
    return $r;
}