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

ParagonIE_Sodium_Core32_Curve25519::fe_sq2() public WP 1.0

Square and double a field element

h = 2 f f

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

Хуков нет.

Возвращает

ParagonIE_Sodium_Core32_Curve25519_Fe.

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

$result = ParagonIE_Sodium_Core32_Curve25519::fe_sq2( $f );
$f(ParagonIE_Sodium_Core32_Curve25519_Fe) (обязательный)

Код ParagonIE_Sodium_Core32_Curve25519::fe_sq2() WP 5.5.1

<?php
public static function fe_sq2(ParagonIE_Sodium_Core32_Curve25519_Fe $f)
{
    /** @var ParagonIE_Sodium_Core32_Int64 $f0 */
    $f0 = $f[0]->toInt64();
    /** @var ParagonIE_Sodium_Core32_Int64 $f1 */
    $f1 = $f[1]->toInt64();
    /** @var ParagonIE_Sodium_Core32_Int64 $f2 */
    $f2 = $f[2]->toInt64();
    /** @var ParagonIE_Sodium_Core32_Int64 $f3 */
    $f3 = $f[3]->toInt64();
    /** @var ParagonIE_Sodium_Core32_Int64 $f4 */
    $f4 = $f[4]->toInt64();
    /** @var ParagonIE_Sodium_Core32_Int64 $f5 */
    $f5 = $f[5]->toInt64();
    /** @var ParagonIE_Sodium_Core32_Int64 $f6 */
    $f6 = $f[6]->toInt64();
    /** @var ParagonIE_Sodium_Core32_Int64 $f7 */
    $f7 = $f[7]->toInt64();
    /** @var ParagonIE_Sodium_Core32_Int64 $f8 */
    $f8 = $f[8]->toInt64();
    /** @var ParagonIE_Sodium_Core32_Int64 $f9 */
    $f9 = $f[9]->toInt64();

    $f0_2 = $f0->shiftLeft(1);
    $f1_2 = $f1->shiftLeft(1);
    $f2_2 = $f2->shiftLeft(1);
    $f3_2 = $f3->shiftLeft(1);
    $f4_2 = $f4->shiftLeft(1);
    $f5_2 = $f5->shiftLeft(1);
    $f6_2 = $f6->shiftLeft(1);
    $f7_2 = $f7->shiftLeft(1);
    $f5_38 = $f5->mulInt(38, 6); /* 1.959375*2^30 */
    $f6_19 = $f6->mulInt(19, 5); /* 1.959375*2^30 */
    $f7_38 = $f7->mulInt(38, 6); /* 1.959375*2^30 */
    $f8_19 = $f8->mulInt(19, 5); /* 1.959375*2^30 */
    $f9_38 = $f9->mulInt(38, 6); /* 1.959375*2^30 */
    $f0f0 = $f0->mulInt64($f0, 28);
    $f0f1_2 = $f0_2->mulInt64($f1, 28);
    $f0f2_2 = $f0_2->mulInt64($f2, 28);
    $f0f3_2 = $f0_2->mulInt64($f3, 28);
    $f0f4_2 = $f0_2->mulInt64($f4, 28);
    $f0f5_2 = $f0_2->mulInt64($f5, 28);
    $f0f6_2 = $f0_2->mulInt64($f6, 28);
    $f0f7_2 = $f0_2->mulInt64($f7, 28);
    $f0f8_2 = $f0_2->mulInt64($f8, 28);
    $f0f9_2 = $f0_2->mulInt64($f9, 28);
    $f1f1_2 = $f1_2->mulInt64($f1, 28);
    $f1f2_2 = $f1_2->mulInt64($f2, 28);
    $f1f3_4 = $f1_2->mulInt64($f3_2, 29);
    $f1f4_2 = $f1_2->mulInt64($f4, 28);
    $f1f5_4 = $f1_2->mulInt64($f5_2, 29);
    $f1f6_2 = $f1_2->mulInt64($f6, 28);
    $f1f7_4 = $f1_2->mulInt64($f7_2, 29);
    $f1f8_2 = $f1_2->mulInt64($f8, 28);
    $f1f9_76 = $f9_38->mulInt64($f1_2, 29);
    $f2f2 = $f2->mulInt64($f2, 28);
    $f2f3_2 = $f2_2->mulInt64($f3, 28);
    $f2f4_2 = $f2_2->mulInt64($f4, 28);
    $f2f5_2 = $f2_2->mulInt64($f5, 28);
    $f2f6_2 = $f2_2->mulInt64($f6, 28);
    $f2f7_2 = $f2_2->mulInt64($f7, 28);
    $f2f8_38 = $f8_19->mulInt64($f2_2, 29);
    $f2f9_38 = $f9_38->mulInt64($f2, 29);
    $f3f3_2 = $f3_2->mulInt64($f3, 28);
    $f3f4_2 = $f3_2->mulInt64($f4, 28);
    $f3f5_4 = $f3_2->mulInt64($f5_2, 28);
    $f3f6_2 = $f3_2->mulInt64($f6, 28);
    $f3f7_76 = $f7_38->mulInt64($f3_2, 29);
    $f3f8_38 = $f8_19->mulInt64($f3_2, 29);
    $f3f9_76 = $f9_38->mulInt64($f3_2, 29);
    $f4f4 = $f4->mulInt64($f4, 28);
    $f4f5_2 = $f4_2->mulInt64($f5, 28);
    $f4f6_38 = $f6_19->mulInt64($f4_2, 29);
    $f4f7_38 = $f7_38->mulInt64($f4, 29);
    $f4f8_38 = $f8_19->mulInt64($f4_2, 29);
    $f4f9_38 = $f9_38->mulInt64($f4, 29);
    $f5f5_38 = $f5_38->mulInt64($f5, 29);
    $f5f6_38 = $f6_19->mulInt64($f5_2, 29);
    $f5f7_76 = $f7_38->mulInt64($f5_2, 29);
    $f5f8_38 = $f8_19->mulInt64($f5_2, 29);
    $f5f9_76 = $f9_38->mulInt64($f5_2, 29);
    $f6f6_19 = $f6_19->mulInt64($f6, 29);
    $f6f7_38 = $f7_38->mulInt64($f6, 29);
    $f6f8_38 = $f8_19->mulInt64($f6_2, 29);
    $f6f9_38 = $f9_38->mulInt64($f6, 29);
    $f7f7_38 = $f7_38->mulInt64($f7, 29);
    $f7f8_38 = $f8_19->mulInt64($f7_2, 29);
    $f7f9_76 = $f9_38->mulInt64($f7_2, 29);
    $f8f8_19 = $f8_19->mulInt64($f8, 29);
    $f8f9_38 = $f9_38->mulInt64($f8, 29);
    $f9f9_38 = $f9_38->mulInt64($f9, 29);

    $h0 = $f0f0->addInt64($f1f9_76)->addInt64($f2f8_38)->addInt64($f3f7_76)->addInt64($f4f6_38)->addInt64($f5f5_38);
    $h1 = $f0f1_2->addInt64($f2f9_38)->addInt64($f3f8_38)->addInt64($f4f7_38)->addInt64($f5f6_38);
    $h2 = $f0f2_2->addInt64($f1f1_2)->addInt64($f3f9_76)->addInt64($f4f8_38)->addInt64($f5f7_76)->addInt64($f6f6_19);
    $h3 = $f0f3_2->addInt64($f1f2_2)->addInt64($f4f9_38)->addInt64($f5f8_38)->addInt64($f6f7_38);
    $h4 = $f0f4_2->addInt64($f1f3_4)->addInt64($f2f2)->addInt64($f5f9_76)->addInt64($f6f8_38)->addInt64($f7f7_38);
    $h5 = $f0f5_2->addInt64($f1f4_2)->addInt64($f2f3_2)->addInt64($f6f9_38)->addInt64($f7f8_38);
    $h6 = $f0f6_2->addInt64($f1f5_4)->addInt64($f2f4_2)->addInt64($f3f3_2)->addInt64($f7f9_76)->addInt64($f8f8_19);
    $h7 = $f0f7_2->addInt64($f1f6_2)->addInt64($f2f5_2)->addInt64($f3f4_2)->addInt64($f8f9_38);
    $h8 = $f0f8_2->addInt64($f1f7_4)->addInt64($f2f6_2)->addInt64($f3f5_4)->addInt64($f4f4)->addInt64($f9f9_38);
    $h9 = $f0f9_2->addInt64($f1f8_2)->addInt64($f2f7_2)->addInt64($f3f6_2)->addInt64($f4f5_2);

    /**
     * @var ParagonIE_Sodium_Core32_Int64 $h0
     * @var ParagonIE_Sodium_Core32_Int64 $h1
     * @var ParagonIE_Sodium_Core32_Int64 $h2
     * @var ParagonIE_Sodium_Core32_Int64 $h3
     * @var ParagonIE_Sodium_Core32_Int64 $h4
     * @var ParagonIE_Sodium_Core32_Int64 $h5
     * @var ParagonIE_Sodium_Core32_Int64 $h6
     * @var ParagonIE_Sodium_Core32_Int64 $h7
     * @var ParagonIE_Sodium_Core32_Int64 $h8
     * @var ParagonIE_Sodium_Core32_Int64 $h9
     */
    $h0 = $h0->shiftLeft(1);
    $h1 = $h1->shiftLeft(1);
    $h2 = $h2->shiftLeft(1);
    $h3 = $h3->shiftLeft(1);
    $h4 = $h4->shiftLeft(1);
    $h5 = $h5->shiftLeft(1);
    $h6 = $h6->shiftLeft(1);
    $h7 = $h7->shiftLeft(1);
    $h8 = $h8->shiftLeft(1);
    $h9 = $h9->shiftLeft(1);

    $carry0 = $h0->addInt(1 << 25)->shiftRight(26);
    $h1 = $h1->addInt64($carry0);
    $h0 = $h0->subInt64($carry0->shiftLeft(26));
    $carry4 = $h4->addInt(1 << 25)->shiftRight(26);
    $h5 = $h5->addInt64($carry4);
    $h4 = $h4->subInt64($carry4->shiftLeft(26));

    $carry1 = $h1->addInt(1 << 24)->shiftRight(25);
    $h2 = $h2->addInt64($carry1);
    $h1 = $h1->subInt64($carry1->shiftLeft(25));
    $carry5 = $h5->addInt(1 << 24)->shiftRight(25);
    $h6 = $h6->addInt64($carry5);
    $h5 = $h5->subInt64($carry5->shiftLeft(25));

    $carry2 = $h2->addInt(1 << 25)->shiftRight(26);
    $h3 = $h3->addInt64($carry2);
    $h2 = $h2->subInt64($carry2->shiftLeft(26));
    $carry6 = $h6->addInt(1 << 25)->shiftRight(26);
    $h7 = $h7->addInt64($carry6);
    $h6 = $h6->subInt64($carry6->shiftLeft(26));

    $carry3 = $h3->addInt(1 << 24)->shiftRight(25);
    $h4 = $h4->addInt64($carry3);
    $h3 = $h3->subInt64($carry3->shiftLeft(25));
    $carry7 = $h7->addInt(1 << 24)->shiftRight(25);
    $h8 = $h8->addInt64($carry7);
    $h7 = $h7->subInt64($carry7->shiftLeft(25));

    $carry4 = $h4->addInt(1 << 25)->shiftRight(26);
    $h5 = $h5->addInt64($carry4);
    $h4 = $h4->subInt64($carry4->shiftLeft(26));
    $carry8 = $h8->addInt(1 << 25)->shiftRight(26);
    $h9 = $h9->addInt64($carry8);
    $h8 = $h8->subInt64($carry8->shiftLeft(26));

    $carry9 = $h9->addInt(1 << 24)->shiftRight(25);
    $h0 = $h0->addInt64($carry9->mulInt(19, 5));
    $h9 = $h9->subInt64($carry9->shiftLeft(25));

    $carry0 = $h0->addInt(1 << 25)->shiftRight(26);
    $h1 = $h1->addInt64($carry0);
    $h0 = $h0->subInt64($carry0->shiftLeft(26));

    return ParagonIE_Sodium_Core32_Curve25519_Fe::fromArray(
        array(
            $h0->toInt32(),
            $h1->toInt32(),
            $h2->toInt32(),
            $h3->toInt32(),
            $h4->toInt32(),
            $h5->toInt32(),
            $h6->toInt32(),
            $h7->toInt32(),
            $h8->toInt32(),
            $h9->toInt32()
        )
    );
}