bjj

package
v0.0.0-...-03d24db Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func New

func New() curve.Point

New creates a new BJJ point (identity element by default).

Types

type BJJ

type BJJ struct {
	// contains filtered or unexported fields
}

BJJ is the affine representation of the BabyJubJub group element.

func (*BJJ) Add

func (g *BJJ) Add(a, b curve.Point)

Add performs the addition of two points and stores the result in g.

func (*BJJ) Equal

func (g *BJJ) Equal(a curve.Point) bool

Equal checks if the given point is equal to the current point.

func (*BJJ) Marshal

func (p *BJJ) Marshal() []byte

Marshal serializes the elliptic curve element into a byte slice.

func (*BJJ) MarshalJSON

func (p *BJJ) MarshalJSON() ([]byte, error)

MarshalJson serializes the elliptic curve element into a JSON byte slice.

func (*BJJ) Neg

func (g *BJJ) Neg(a curve.Point)

Neg negates the given point and stores the result in g.

func (*BJJ) New

func (g *BJJ) New() curve.Point

New creates a new BJJ point (identity element by default).

func (*BJJ) Order

func (g *BJJ) Order() *big.Int

Order returns the order of the BabyJubJub curve subgroup.

func (*BJJ) Point

func (p *BJJ) Point() (*big.Int, *big.Int)

Point returns the X and Y coordinates of the elliptic curve element in Twisted Edwards coordinates.

func (*BJJ) SafeAdd

func (g *BJJ) SafeAdd(a, b curve.Point)

SafeAdd performs the addition of two points with a lock.

func (*BJJ) ScalarBaseMult

func (g *BJJ) ScalarBaseMult(scalar *big.Int)

ScalarBaseMult performs scalar multiplication using the base point.

func (*BJJ) ScalarMult

func (g *BJJ) ScalarMult(a curve.Point, scalar *big.Int)

ScalarMult performs scalar multiplication of a point by a scalar.

func (*BJJ) Set

func (g *BJJ) Set(a curve.Point)

Set sets g to the value of another point.

func (*BJJ) SetGenerator

func (g *BJJ) SetGenerator()

SetGenerator sets the point to the BabyJubJub generator.

func (*BJJ) SetPoint

func (p *BJJ) SetPoint(x, y *big.Int) curve.Point

SetPoint sets the elliptic curve element from the X and Y coordinates in Twisted Edwards coordinates.

func (*BJJ) SetZero

func (g *BJJ) SetZero()

SetZero sets the current point to the identity element (0, 1).

func (*BJJ) String

func (g *BJJ) String() string

String returns a string representation of the point in Twisted Edwards coordinates.

func (*BJJ) Unmarshal

func (p *BJJ) Unmarshal(buf []byte) error

Unmarshal deserializes the elliptic curve element from a byte slice.

func (*BJJ) UnmarshalJSON

func (p *BJJ) UnmarshalJSON(buf []byte) error

UnmarshalJson deserializes the elliptic curve element from a JSON byte slice.

Jump to

Keyboard shortcuts

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