Documentation
¶
Overview ¶
Package bn256 holds everything related to the `bn256` elliptic curve (sometimes called `alt_bn128`) used in Ethereum. It defines an bilinear pairing associated with an elliptic curve over a finite field with a 256-bit prime; the actual curve definition is in the cloudflare package, and the code here consists of useful helper functions. Although originally designed to provide 128 bits of security, recent developments in factoring algorithms have reduced this security to approximately 100 bits.
Index ¶
- Variables
- func BigIntArraySliceToG1(g1BigIntArray [][2]*big.Int) ([]*cloudflare.G1, error)
- func BigIntArrayToG1(g1BigInt [2]*big.Int) (*cloudflare.G1, error)
- func BigIntArrayToG2(g2BigInt [4]*big.Int) (*cloudflare.G2, error)
- func G1ToBigIntArray(g1 *cloudflare.G1) ([2]*big.Int, error)
- func G2ToBigIntArray(g2 *cloudflare.G2) ([4]*big.Int, error)
- func MarshalBigInt(x *big.Int) ([]byte, error)
- func MarshalBigIntSlice(bigSlice []*big.Int) ([]byte, error)
- func MarshalG1Big(hashPoint [2]*big.Int) ([]byte, error)
- func MarshalG1BigSlice(g1BigSlice [][2]*big.Int) ([]byte, error)
- func MarshalG2Big(hashPoint [4]*big.Int) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidData = errors.New("invalid state")
ErrInvalidData occurs state is invalid
var ErrNotUint256 = errors.New("big.Ints are not at most 256-bit unsigned integers")
ErrNotUint256 occurs when we work with a uint with more than 256 bits
Functions ¶
func BigIntArraySliceToG1 ¶
func BigIntArraySliceToG1(g1BigIntArray [][2]*big.Int) ([]*cloudflare.G1, error)
BigIntArraySliceToG1 converts Ethereum big.Int G1 array slice into cloudflare.G1 slice for computing purposes.
func BigIntArrayToG1 ¶
func BigIntArrayToG1(g1BigInt [2]*big.Int) (*cloudflare.G1, error)
BigIntArrayToG1 converts Ethereum big.Int G1 arrays into cloudflare.G1 elements for computing purposes.
func BigIntArrayToG2 ¶
func BigIntArrayToG2(g2BigInt [4]*big.Int) (*cloudflare.G2, error)
BigIntArrayToG2 converts Ethereum big.Int G2 arrays into cloudflare.G2 elements for computing purposes.
func G1ToBigIntArray ¶
func G1ToBigIntArray(g1 *cloudflare.G1) ([2]*big.Int, error)
G1ToBigIntArray converts cloudflare.G2 into big.Int array for testing purposes.
func G2ToBigIntArray ¶
func G2ToBigIntArray(g2 *cloudflare.G2) ([4]*big.Int, error)
G2ToBigIntArray converts cloudflare.G2 into big.Int array for testing purposes.
func MarshalBigInt ¶
MarshalBigInt converts a 256-bit uint into a byte slice.
func MarshalBigIntSlice ¶
MarshalBigIntSlice returns a byte slice for encoding that we will use to check that we hash to the correct value. All of these values are assumed to be uint256.
func MarshalG1Big ¶
MarshalG1Big is used to compare the result from Go code generated by Solidity with the original Go code in cloudflare directory.
func MarshalG1BigSlice ¶
MarshalG1BigSlice creates a byte slice from G1Big slice. This is used in testing purposes.
Types ¶
This section is empty.
Directories
¶
Path | Synopsis |
---|---|
Package cloudflare implements a particular bilinear group at the 128-bit security level.
|
Package cloudflare implements a particular bilinear group at the 128-bit security level. |