altbn128

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecompressToG1

func DecompressToG1(m []byte) (*bn256.G1, error)

DecompressToG1 decompresses byte slice into G1 point by extracting Y parity bit from the first byte, extracting X value and calculating original Y value based on the extracted Y parity. The parity bit is encoded in the top byte as 0x01 (even) or 0x00 (odd).

func DecompressToG2

func DecompressToG2(m []byte) (*bn256.G2, error)

DecompressToG2 decompresses byte slice into G2 point by extracting Y parity bit from the first byte, extracting X value and calculating original Y value based on the extracted Y parity. The parity bit is encoded in the top byte as 0x01 (even) or 0x00 (odd).

func G1FromInts

func G1FromInts(x *big.Int, y *big.Int) (*bn256.G1, error)

G1FromInts returns G1 point based on the provided x and y.

func G1HashToPoint

func G1HashToPoint(m []byte) *bn256.G1

G1HashToPoint hashes the provided byte slice, maps it into a G1 and returns it as a G1 point.

func G2FromInts

func G2FromInts(x *gfP2, y *gfP2) (*bn256.G2, error)

G2FromInts returns G2 point based on the provided x and y in Fp^2.

Types

type G1Point

type G1Point struct {
	*bn256.G1
}

G1Point represents G1 point.

func (G1Point) Compress

func (g G1Point) Compress() []byte

Compress compresses point by using X value and the parity bit of Y encoded into the first byte.

type G2Point

type G2Point struct {
	*bn256.G2
}

G2Point represents G2 point.

func (G2Point) Compress

func (g G2Point) Compress() []byte

Compress compresses point by using X value and the parity bit of Y encoded into the first byte.

Jump to

Keyboard shortcuts

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