You are here

public static function ParagonIE_Sodium_Core32_Curve25519::ge_tobytes in Automatic Updates 8

Same name and namespace in other branches
  1. 7 vendor/paragonie/sodium_compat/src/Core32/Curve25519.php \ParagonIE_Sodium_Core32_Curve25519::ge_tobytes()

Convert a group element to a byte string.

Parameters

ParagonIE_Sodium_Core32_Curve25519_Ge_P2 $h:

Return value

string

Throws

SodiumException

TypeError

1 call to ParagonIE_Sodium_Core32_Curve25519::ge_tobytes()
ParagonIE_Sodium_Core32_Ed25519::verify_detached in vendor/paragonie/sodium_compat/src/Core32/Ed25519.php
@internal You should not use this directly from another application

File

vendor/paragonie/sodium_compat/src/Core32/Curve25519.php, line 2020

Class

ParagonIE_Sodium_Core32_Curve25519
Class ParagonIE_Sodium_Core32_Curve25519

Code

public static function ge_tobytes(ParagonIE_Sodium_Core32_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;
}