mcl

package
v0.0.0-...-a4754aa Latest Latest
Warning

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

Go to latest
Published: May 15, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const BLS12_381 = C.MCL_BLS12_381

BLS12_381 --

View Source
const CurveFp254BNb = C.mclBn_CurveFp254BNb

CurveFp254BNb -- 254 bit curve

View Source
const CurveFp382_1 = C.mclBn_CurveFp382_1

CurveFp382_1 -- 382 bit curve 1

View Source
const CurveFp382_2 = C.mclBn_CurveFp382_2

CurveFp382_2 -- 382 bit curve 2

View Source
const IO_EC_AFFINE = C.MCLBN_IO_EC_AFFINE

IO_EC_AFFINE --

View Source
const IO_EC_PROJ = C.MCLBN_IO_EC_PROJ

IO_EC_PROJ --

View Source
const IRTF = 5 /* MCL_MAP_TO_MODE_HASH_TO_CURVE_07 */

IRTF -- for SetMapToMode

View Source
const IoSerializeHexStr = C.MCLBN_IO_SERIALIZE_HEX_STR

IoSerializeHexStr --

View Source
const ZERO_HEADER = 1 << 6

Variables

This section is empty.

Functions

func FinalExp

func FinalExp(out *GT, x *GT)

FinalExp --

func Fp2Add

func Fp2Add(out *Fp2, x *Fp2, y *Fp2)

Fp2Add --

func Fp2Div

func Fp2Div(out *Fp2, x *Fp2, y *Fp2)

Fp2Div --

func Fp2Inv

func Fp2Inv(out *Fp2, x *Fp2)

Fp2Inv --

func Fp2Mul

func Fp2Mul(out *Fp2, x *Fp2, y *Fp2)

Fp2Mul --

func Fp2Neg

func Fp2Neg(out *Fp2, x *Fp2)

Fp2Neg --

func Fp2Sqr

func Fp2Sqr(out *Fp2, x *Fp2)

Fp2Sqr --

func Fp2SquareRoot

func Fp2SquareRoot(out *Fp2, x *Fp2) bool

Fp2SquareRoot --

func Fp2Sub

func Fp2Sub(out *Fp2, x *Fp2, y *Fp2)

Fp2Sub --

func FpAdd

func FpAdd(out *Fp, x *Fp, y *Fp)

FpAdd --

func FpDiv

func FpDiv(out *Fp, x *Fp, y *Fp)

FpDiv --

func FpInv

func FpInv(out *Fp, x *Fp)

FpInv --

func FpMul

func FpMul(out *Fp, x *Fp, y *Fp)

FpMul --

func FpNeg

func FpNeg(out *Fp, x *Fp)

FpNeg --

func FpSqr

func FpSqr(out *Fp, x *Fp)

FpSqr --

func FpSquareRoot

func FpSquareRoot(out *Fp, x *Fp) bool

FpSquareRoot --

func FpSub

func FpSub(out *Fp, x *Fp, y *Fp)

FpSub --

func FrAdd

func FrAdd(out *Fr, x *Fr, y *Fr)

FrAdd --

func FrDiv

func FrDiv(out *Fr, x *Fr, y *Fr)

FrDiv --

func FrEvaluatePolynomial

func FrEvaluatePolynomial(y *Fr, c []Fr, x *Fr) error

FrEvaluatePolynomial -- y = c[0] + c[1] * x + c[2] * x^2 + ...

func FrInv

func FrInv(out *Fr, x *Fr)

FrInv --

func FrLagrangeInterpolation

func FrLagrangeInterpolation(out *Fr, xVec []Fr, yVec []Fr) error

FrLagrangeInterpolation --

func FrMul

func FrMul(out *Fr, x *Fr, y *Fr)

FrMul --

func FrNeg

func FrNeg(out *Fr, x *Fr)

FrNeg --

func FrSqr

func FrSqr(out *Fr, x *Fr)

FrSqr --

func FrSquareRoot

func FrSquareRoot(out *Fr, x *Fr) bool

FrSquareRoot --

func FrSub

func FrSub(out *Fr, x *Fr, y *Fr)

FrSub --

func G1Add

func G1Add(out *G1, x *G1, y *G1)

G1Add --

func G1Dbl

func G1Dbl(out *G1, x *G1)

G1Dbl --

func G1EvaluatePolynomial

func G1EvaluatePolynomial(y *G1, c []G1, x *Fr) error

G1EvaluatePolynomial -- y = c[0] + c[1] * x + c[2] * x^2 + ...

func G1LagrangeInterpolation

func G1LagrangeInterpolation(out *G1, xVec []Fr, yVec []G1) error

G1LagrangeInterpolation --

func G1Mul

func G1Mul(out *G1, x *G1, y *Fr)

G1Mul --

func G1MulCT

func G1MulCT(out *G1, x *G1, y *Fr)

G1MulCT -- constant time (depending on bit lengh of y)

func G1MulVec

func G1MulVec(out *G1, xVec []G1, yVec []Fr)

G1MulVec -- multi scalar multiplication out = sum mul(xVec[i], yVec[i])

func G1Neg

func G1Neg(out *G1, x *G1)

G1Neg --

func G1Normalize

func G1Normalize(out *G1, x *G1)

G1Normalize --

func G1Sub

func G1Sub(out *G1, x *G1, y *G1)

G1Sub --

func G2Add

func G2Add(out *G2, x *G2, y *G2)

G2Add --

func G2Dbl

func G2Dbl(out *G2, x *G2)

G2Dbl --

func G2EvaluatePolynomial

func G2EvaluatePolynomial(y *G2, c []G2, x *Fr) error

G2EvaluatePolynomial -- y = c[0] + c[1] * x + c[2] * x^2 + ...

func G2LagrangeInterpolation

func G2LagrangeInterpolation(out *G2, xVec []Fr, yVec []G2) error

G2LagrangeInterpolation --

func G2Mul

func G2Mul(out *G2, x *G2, y *Fr)

G2Mul --

func G2MulVec

func G2MulVec(out *G2, xVec []G2, yVec []Fr)

G2MulVec -- multi scalar multiplication out = sum mul(xVec[i], yVec[i])

func G2Neg

func G2Neg(out *G2, x *G2)

G2Neg --

func G2Normalize

func G2Normalize(out *G2, x *G2)

G2Normalize --

func G2Sub

func G2Sub(out *G2, x *G2, y *G2)

G2Sub --

func GTAdd

func GTAdd(out *GT, x *GT, y *GT)

GTAdd --

func GTDiv

func GTDiv(out *GT, x *GT, y *GT)

GTDiv --

func GTInv

func GTInv(out *GT, x *GT)

GTInv --

func GTMul

func GTMul(out *GT, x *GT, y *GT)

GTMul --

func GTNeg

func GTNeg(out *GT, x *GT)

GTNeg --

func GTPow

func GTPow(out *GT, x *GT, y *Fr)

GTPow --

func GTSub

func GTSub(out *GT, x *GT, y *GT)

GTSub --

func GetCurveOrder

func GetCurveOrder() string

GetCurveOrder -- return the order of G1

func GetFieldOrder

func GetFieldOrder() string

GetFieldOrder -- return the characteristic of the field where a curve is defined

func GetFpByteSize

func GetFpByteSize() int

GetFpByteSize -- the serialized size of Fp

func GetFpUnitSize

func GetFpUnitSize() int

GetFpUnitSize -- same as GetMaxOpUnitSize()

func GetFrByteSize

func GetFrByteSize() int

GetFrByteSize -- the serialized size of Fr

func GetFrUnitSize

func GetFrUnitSize() int

GetFrUnitSize --

func GetG1ByteSize

func GetG1ByteSize() int

GetG1ByteSize -- the serialized size of G1

func GetG2ByteSize

func GetG2ByteSize() int

GetG2ByteSize -- the serialized size of G2

func GetMaxOpUnitSize

func GetMaxOpUnitSize() int

GetMaxOpUnitSize --

func GetOpUnitSize

func GetOpUnitSize() int

GetOpUnitSize -- the length of Fr is GetOpUnitSize() * 8 bytes

func GetUint64NumToPrecompute

func GetUint64NumToPrecompute() int

GetUint64NumToPrecompute --

func Init

func Init(curve int) error

Init -- call this function before calling all the other operations this function is not thread safe

func MapToG1

func MapToG1(out *G1, x *Fp) error

MapToG1 --

func MapToG2

func MapToG2(out *G2, x *Fp2) error

MapToG2 --

func MillerLoop

func MillerLoop(out *GT, x *G1, y *G2)

MillerLoop --

func MillerLoopVec

func MillerLoopVec(out *GT, xVec []G1, yVec []G2)

MillerLoopVec -- multi pairings ; out = prod_i e(xVec[i], yVec[i])

func Pairing

func Pairing(out *GT, x *G1, y *G2)

Pairing --

func PrecomputeG2

func PrecomputeG2(Qbuf []uint64, Q *G2)

PrecomputeG2 --

func PrecomputedMillerLoop

func PrecomputedMillerLoop(out *GT, P *G1, Qbuf []uint64)

PrecomputedMillerLoop --

func PrecomputedMillerLoop2

func PrecomputedMillerLoop2(out *GT, P1 *G1, Q1buf []uint64, P2 *G1, Q2buf []uint64)

PrecomputedMillerLoop2 --

func SetETHserialization

func SetETHserialization(enable bool)

SetETHserialization --

func SetMapToMode

func SetMapToMode(mode int) error

SetMapToMode --

func VerifyOrderG1

func VerifyOrderG1(doVerify bool)

VerifyOrderG1 -- verify order if SetString/Deserialize are called

func VerifyOrderG2

func VerifyOrderG2(doVerify bool)

VerifyOrderG2 -- verify order if SetString/Deserialize are called

Types

type Fp

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

Fp --

func (*Fp) Clear

func (x *Fp) Clear()

Clear --

func (*Fp) Deserialize

func (x *Fp) Deserialize(buf []byte) error

Deserialize --

func (*Fp) GetString

func (x *Fp) GetString(base int) string

GetString --

func (*Fp) IsEqual

func (x *Fp) IsEqual(rhs *Fp) bool

IsEqual --

func (*Fp) IsNegative

func (x *Fp) IsNegative() bool

IsNegative -- true if x >= (p + 1) / 2

func (*Fp) IsOdd

func (x *Fp) IsOdd() bool

IsOdd --

func (*Fp) IsOne

func (x *Fp) IsOne() bool

IsOne --

func (*Fp) IsValid

func (x *Fp) IsValid() bool

IsValid --

func (*Fp) IsZero

func (x *Fp) IsZero() bool

IsZero --

func (*Fp) Serialize

func (x *Fp) Serialize() []byte

Serialize --

func (*Fp) SetBigEndianMod

func (x *Fp) SetBigEndianMod(buf []byte) error

SetBigEndianMod --

func (*Fp) SetByCSPRNG

func (x *Fp) SetByCSPRNG()

SetByCSPRNG --

func (*Fp) SetHashOf

func (x *Fp) SetHashOf(buf []byte) bool

SetHashOf --

func (*Fp) SetInt64

func (x *Fp) SetInt64(v int64)

SetInt64 --

func (*Fp) SetLittleEndian

func (x *Fp) SetLittleEndian(buf []byte) error

SetLittleEndian --

func (*Fp) SetLittleEndianMod

func (x *Fp) SetLittleEndianMod(buf []byte) error

SetLittleEndianMod --

func (*Fp) SetString

func (x *Fp) SetString(s string, base int) error

SetString --

type Fp2

type Fp2 struct {
	D [2]Fp
}

Fp2 -- x = D[0] + D[1] i where i^2 = -1

func (*Fp2) Clear

func (x *Fp2) Clear()

Clear --

func (*Fp2) Deserialize

func (x *Fp2) Deserialize(buf []byte) error

Deserialize --

func (*Fp2) IsEqual

func (x *Fp2) IsEqual(rhs *Fp2) bool

IsEqual --

func (*Fp2) IsOne

func (x *Fp2) IsOne() bool

IsOne --

func (*Fp2) IsZero

func (x *Fp2) IsZero() bool

IsZero --

func (*Fp2) Serialize

func (x *Fp2) Serialize() []byte

Serialize --

type Fr

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

Fr --

func (*Fr) Clear

func (x *Fr) Clear()

Clear --

func (*Fr) Deserialize

func (x *Fr) Deserialize(buf []byte) error

Deserialize --

func (*Fr) GetString

func (x *Fr) GetString(base int) string

GetString --

func (*Fr) IsEqual

func (x *Fr) IsEqual(rhs *Fr) bool

IsEqual --

func (*Fr) IsNegative

func (x *Fr) IsNegative() bool

IsNegative -- true if x >= (r + 1) / 2

func (*Fr) IsOdd

func (x *Fr) IsOdd() bool

IsOdd --

func (*Fr) IsOne

func (x *Fr) IsOne() bool

IsOne --

func (*Fr) IsValid

func (x *Fr) IsValid() bool

IsValid --

func (*Fr) IsZero

func (x *Fr) IsZero() bool

IsZero --

func (*Fr) Serialize

func (x *Fr) Serialize() []byte

Serialize --

func (*Fr) SetBigEndianMod

func (x *Fr) SetBigEndianMod(buf []byte) error

SetBigEndianMod --

func (*Fr) SetByCSPRNG

func (x *Fr) SetByCSPRNG()

SetByCSPRNG --

func (*Fr) SetHashOf

func (x *Fr) SetHashOf(buf []byte) bool

SetHashOf --

func (*Fr) SetInt64

func (x *Fr) SetInt64(v int64)

SetInt64 --

func (*Fr) SetLittleEndian

func (x *Fr) SetLittleEndian(buf []byte) error

SetLittleEndian --

func (*Fr) SetLittleEndianMod

func (x *Fr) SetLittleEndianMod(buf []byte) error

SetLittleEndianMod --

func (*Fr) SetString

func (x *Fr) SetString(s string, base int) error

SetString --

type G1

type G1 struct {
	X Fp
	Y Fp
	Z Fp
}

G1 --

func (*G1) Clear

func (x *G1) Clear()

Clear --

func (*G1) Deserialize

func (x *G1) Deserialize(buf []byte) error

Deserialize --

func (*G1) DeserializeUncompressed

func (x *G1) DeserializeUncompressed(buf []byte) error

DeserializeUncompressed -- x.Deserialize() + y.Deserialize()

func (*G1) GetString

func (x *G1) GetString(base int) string

GetString --

func (*G1) HashAndMapTo

func (x *G1) HashAndMapTo(buf []byte) error

HashAndMapTo --

func (*G1) IsEqual

func (x *G1) IsEqual(rhs *G1) bool

IsEqual --

func (*G1) IsValid

func (x *G1) IsValid() bool

IsValid --

func (*G1) IsValidOrder

func (x *G1) IsValidOrder() bool

IsValidOrder --

func (*G1) IsZero

func (x *G1) IsZero() bool

IsZero --

func (*G1) Serialize

func (x *G1) Serialize() []byte

Serialize --

func (*G1) SerializeUncompressed

func (x *G1) SerializeUncompressed() []byte

SerializeUncompressed -- all zero array if x.IsZero()

func (*G1) SetString

func (x *G1) SetString(s string, base int) error

SetString --

type G2

type G2 struct {
	X Fp2
	Y Fp2
	Z Fp2
}

G2 --

func (*G2) Clear

func (x *G2) Clear()

Clear --

func (*G2) Deserialize

func (x *G2) Deserialize(buf []byte) error

Deserialize --

func (*G2) DeserializeUncompressed

func (x *G2) DeserializeUncompressed(buf []byte) error

DeserializeUncompressed -- x.Deserialize() + y.Deserialize()

func (*G2) GetString

func (x *G2) GetString(base int) string

GetString --

func (*G2) HashAndMapTo

func (x *G2) HashAndMapTo(buf []byte) error

HashAndMapTo --

func (*G2) IsEqual

func (x *G2) IsEqual(rhs *G2) bool

IsEqual --

func (*G2) IsValid

func (x *G2) IsValid() bool

IsValid --

func (*G2) IsValidOrder

func (x *G2) IsValidOrder() bool

IsValidOrder --

func (*G2) IsZero

func (x *G2) IsZero() bool

IsZero --

func (*G2) Serialize

func (x *G2) Serialize() []byte

Serialize --

func (*G2) SerializeUncompressed

func (x *G2) SerializeUncompressed() []byte

SerializeUncompressed -- all zero array if x.IsZero()

func (*G2) SetString

func (x *G2) SetString(s string, base int) error

SetString --

type GT

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

GT --

func (*GT) Clear

func (x *GT) Clear()

Clear --

func (*GT) Deserialize

func (x *GT) Deserialize(buf []byte) error

Deserialize --

func (*GT) GetString

func (x *GT) GetString(base int) string

GetString --

func (*GT) IsEqual

func (x *GT) IsEqual(rhs *GT) bool

IsEqual --

func (*GT) IsOne

func (x *GT) IsOne() bool

IsOne --

func (*GT) IsZero

func (x *GT) IsZero() bool

IsZero --

func (*GT) Serialize

func (x *GT) Serialize() []byte

Serialize --

func (*GT) SetInt64

func (x *GT) SetInt64(v int64)

SetInt64 --

func (*GT) SetString

func (x *GT) SetString(s string, base int) error

SetString --

Jump to

Keyboard shortcuts

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