format

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2026 License: AGPL-3.0 Imports: 8 Imported by: 1

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromEmulatedRTEtoTE

FromEmulatedRTEtoTE converts a point from Reduced TwistedEdwards to TwistedEdwards coordinates using emulated BN254 elements.

func FromRTEtoTE

func FromRTEtoTE(x, y *big.Int) (*big.Int, *big.Int)

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

func FromTEtoRTE(x, y *big.Int) (*big.Int, *big.Int)

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

func SplitYForBn254FromBLS12381(z *big.Int) ([4]*big.Int, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL