Documentation
¶
Overview ¶
Package format provides helper functions to transform points (x, y) from TwistedEdwards to Reduced TwistedEdwards and vice versa. These functions are required because Gnark uses the Reduced TwistedEdwards formula while Iden3 uses the standard TwistedEdwards formula. See https://github.com/bellesmarta/baby_jubjub for more information.
Index ¶
- func FromEmulatedRTEtoTE(api frontend.API, x, y emulated.Element[sw_bn254.ScalarField]) (emulated.Element[sw_bn254.ScalarField], emulated.Element[sw_bn254.ScalarField], ...)
- func FromRTEtoTE(x, y *big.Int) (*big.Int, *big.Int)
- func FromRTEtoTEVar(api frontend.API, x, y frontend.Variable) (frontend.Variable, frontend.Variable)
- func FromTEtoRTE(x, y *big.Int) (*big.Int, *big.Int)
- func SplitIntoEmulatedLimbsLE[T emulated.FieldParams](nativeField *big.Int, z *big.Int) ([]*big.Int, error)
- func SplitYForBn254FromBLS12381(z *big.Int) ([4]*big.Int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromEmulatedRTEtoTE ¶
func FromEmulatedRTEtoTE( api frontend.API, x, y emulated.Element[sw_bn254.ScalarField], ) (emulated.Element[sw_bn254.ScalarField], emulated.Element[sw_bn254.ScalarField], error)
FromEmulatedRTEtoTE converts a point from Reduced TwistedEdwards to TwistedEdwards coordinates using emulated BN254 elements.
func FromRTEtoTE ¶
FromRTEtoTE converts a point from Reduced TwistedEdwards to TwistedEdwards coordinates (from Gnark to Iden3). It applies the transformation:
x = x'/(-f) y' = y
func FromRTEtoTEVar ¶
func FromRTEtoTEVar(api frontend.API, x, y frontend.Variable) (frontend.Variable, frontend.Variable)
FromRTEtoTEVar converts a point from Reduced TwistedEdwards to TwistedEdwards coordinates using frontend variables.
func FromTEtoRTE ¶
FromTEtoRTE converts a point from TwistedEdwards to Reduced TwistedEdwards coordinates (from Iden3 to Gnark). It applies the transformation:
x' = x*(-f) y = y'
func SplitIntoEmulatedLimbsLE ¶
func SplitIntoEmulatedLimbsLE[T emulated.FieldParams](nativeField *big.Int, z *big.Int) ([]*big.Int, error)
SplitIntoEmulatedLimbsLE returns gnark-emulated limbs (little-endian) for z in field T. nativeField is the circuit's native scalar field modulus (e.g. ecc.BN254.ScalarField()).
func SplitYForBn254FromBLS12381 ¶
SplitYForBn254FromBLS12381 splits a BLS12-381 scalar field element z into limbs for emulation in a BN254 circuit. It returns the limbs as [4]*big.Int in little-endian order. The returned limbs can be used to reconstruct z within a gnark circuit emulating BLS12-381 Fr.
Types ¶
This section is empty.