ParagonIE_Sodium_Core_Curve25519::ge_tobytes

Advertisement

Summery Summery

Convert a group element to a byte string.

Syntax Syntax

ParagonIE_Sodium_Core_Curve25519::ge_tobytes( ParagonIE_Sodium_Core_Curve25519_Ge_P2 $h )

Parameters Parameters

$h

(ParagonIE_Sodium_Core_Curve25519_Ge_P2) (Required)

Return Return

(string)

Source Source

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

    public static function ge_tobytes(ParagonIE_Sodium_Core_Curve25519_Ge_P2 $h)
    {
        $recip = self::fe_invert($h->Z);
        $x = self::fe_mul($h->X, $recip);
        $y = self::fe_mul($h->Y, $recip);
        $s = self::fe_tobytes($y);
        $s[31] = self::intToChr(
            self::chrToInt($s[31]) ^ (self::fe_isnegative($x) << 7)
        );
        return $s;
    }

Advertisement

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.