curves

package
v0.0.0-...-92246cd Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Altbn128 = &altbn128{}

Altbn128Inst is the instance for the altbn128 curve, with all of its functions.

Functions

func AltbnBlake2b

func AltbnBlake2b(message []byte) []*big.Int

AltbnBlake2b Hashes a message to a point on Altbn128 using Blake2b and try and increment The return value is the x,y affine coordinate pair.

func AltbnKeccak3

func AltbnKeccak3(message []byte) []*big.Int

AltbnKeccak3 Hashes a message to a point on Altbn128 using Keccak3 and try and increment Keccak3 is only for compatability with Ethereum hashing. The return value is the x,y affine coordinate pair.

func AltbnSha3

func AltbnSha3(message []byte) []*big.Int

AltbnSha3 Hashes a message to a point on Altbn128 using SHA3 and try and increment The return value is the x,y affine coordinate pair.

func EthereumSum256

func EthereumSum256(data []byte) (digest [32]byte)

EthereumSum256 returns the Keccak3-256 digest of the data. This is because Ethereum uses a non-standard hashing algo.

Types

type CurveSystem

type CurveSystem interface {
	Name() string

	MakeG1Point([]*big.Int, bool) (Point, bool)
	MakeG2Point([]*big.Int, bool) (Point, bool)

	UnmarshalG1([]byte) (Point, bool)
	UnmarshalG2([]byte) (Point, bool)
	UnmarshalGT([]byte) (PointT, bool)

	GetG1() Point
	GetG2() Point
	GetGT() PointT

	GetG1Infinity() Point
	GetG2Infinity() Point
	GetGTIdentity() PointT

	HashToG1(message []byte) Point

	GetG1Q() *big.Int
	GetG1Order() *big.Int

	Pair(Point, Point) (PointT, bool)
	// Product of Pairings
	PairingProduct([]Point, []Point) (PointT, bool)
	// contains filtered or unexported methods
}

CurveSystem is a set of parameters and functions for a pairing based cryptosystem It has everything necessary to support all bgls functionality which we use.

type Point

type Point interface {
	Add(Point) (Point, bool)
	Copy() Point
	Equals(Point) bool
	Marshal() []byte
	MarshalUncompressed() []byte
	Mul(*big.Int) Point
	ToAffineCoords() []*big.Int
}

Point is a way to represent a point on G1 or G2, in the first two elliptic curves.

func AggregatePoints

func AggregatePoints(points []Point) Point

AggregatePoints takes the sum of points.

func ScalePoints

func ScalePoints(pts []Point, factors []*big.Int) (newKeys []Point)

ScalePoints takes a set of points, and a set of multiples, and returns a new set of points multiplied by the corresponding factor.

type PointT

type PointT interface {
	Add(PointT) (PointT, bool)
	Copy() PointT
	Equals(PointT) bool
	Marshal() []byte
	Mul(*big.Int) PointT
}

PointT is a way to represent a point on GT, in the target group

Jump to

Keyboard shortcuts

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