Documentation ¶
Index ¶
- Constants
- func BlsGetGeneratorOfPublicKey(pub *PublicKey)
- func FinalExp(out *GT, x *GT)
- func Fp2Add(out *Fp2, x *Fp2, y *Fp2)
- func Fp2Div(out *Fp2, x *Fp2, y *Fp2)
- func Fp2Inv(out *Fp2, x *Fp2)
- func Fp2Mul(out *Fp2, x *Fp2, y *Fp2)
- func Fp2Neg(out *Fp2, x *Fp2)
- func Fp2Sqr(out *Fp2, x *Fp2)
- func Fp2SquareRoot(out *Fp2, x *Fp2) bool
- func Fp2Sub(out *Fp2, x *Fp2, y *Fp2)
- func FpAdd(out *Fp, x *Fp, y *Fp)
- func FpDiv(out *Fp, x *Fp, y *Fp)
- func FpInv(out *Fp, x *Fp)
- func FpMul(out *Fp, x *Fp, y *Fp)
- func FpNeg(out *Fp, x *Fp)
- func FpSqr(out *Fp, x *Fp)
- func FpSquareRoot(out *Fp, x *Fp) bool
- func FpSub(out *Fp, x *Fp, y *Fp)
- func FrAdd(out *Fr, x *Fr, y *Fr)
- func FrDiv(out *Fr, x *Fr, y *Fr)
- func FrEvaluatePolynomial(y *Fr, c []Fr, x *Fr) error
- func FrInv(out *Fr, x *Fr)
- func FrLagrangeInterpolation(out *Fr, xVec []Fr, yVec []Fr) error
- func FrMul(out *Fr, x *Fr, y *Fr)
- func FrNeg(out *Fr, x *Fr)
- func FrSqr(out *Fr, x *Fr)
- func FrSquareRoot(out *Fr, x *Fr) bool
- func FrSub(out *Fr, x *Fr, y *Fr)
- func G1Add(out *G1, x *G1, y *G1)
- func G1Dbl(out *G1, x *G1)
- func G1EvaluatePolynomial(y *G1, c []G1, x *Fr) error
- func G1LagrangeInterpolation(out *G1, xVec []Fr, yVec []G1) error
- func G1Mul(out *G1, x *G1, y *Fr)
- func G1MulCT(out *G1, x *G1, y *Fr)
- func G1MulVec(out *G1, xVec []G1, yVec []Fr)
- func G1Neg(out *G1, x *G1)
- func G1Normalize(out *G1, x *G1)
- func G1Sub(out *G1, x *G1, y *G1)
- func G2Add(out *G2, x *G2, y *G2)
- func G2Dbl(out *G2, x *G2)
- func G2EvaluatePolynomial(y *G2, c []G2, x *Fr) error
- func G2LagrangeInterpolation(out *G2, xVec []Fr, yVec []G2) error
- func G2Mul(out *G2, x *G2, y *Fr)
- func G2MulVec(out *G2, xVec []G2, yVec []Fr)
- func G2Neg(out *G2, x *G2)
- func G2Normalize(out *G2, x *G2)
- func G2Sub(out *G2, x *G2, y *G2)
- func GTAdd(out *GT, x *GT, y *GT)
- func GTDiv(out *GT, x *GT, y *GT)
- func GTInv(out *GT, x *GT)
- func GTMul(out *GT, x *GT, y *GT)
- func GTNeg(out *GT, x *GT)
- func GTPow(out *GT, x *GT, y *Fr)
- func GTSub(out *GT, x *GT, y *GT)
- func GetCurveOrder() string
- func GetFieldOrder() string
- func GetFpByteSize() int
- func GetFpUnitSize() int
- func GetFrByteSize() int
- func GetFrUnitSize() int
- func GetG1ByteSize() int
- func GetG2ByteSize() int
- func GetGeneratorOfPublicKey(pub *PublicKey)
- func GetMaxOpUnitSize() int
- func GetOpUnitSize() int
- func GetUint64NumToPrecompute() int
- func Init(curve int) error
- func MapToG1(out *G1, x *Fp) error
- func MapToG2(out *G2, x *Fp2) error
- func MillerLoop(out *GT, x *G1, y *G2)
- func MillerLoopVec(out *GT, xVec []G1, yVec []G2)
- func Pairing(out *GT, x *G1, y *G2)
- func PrecomputeG2(Qbuf []uint64, Q *G2)
- func PrecomputedMillerLoop(out *GT, P *G1, Qbuf []uint64)
- func PrecomputedMillerLoop2(out *GT, P1 *G1, Q1buf []uint64, P2 *G1, Q2buf []uint64)
- func SetETHserialization(enable bool)
- func SetGeneratorOfPublicKey(pub *PublicKey) error
- func SetMapToMode(mode int) error
- func SetRandFunc(randReader io.Reader)
- func SignatureVerifyOrder(doVerify bool)
- func VerifyOrderG1(doVerify bool)
- func VerifyOrderG2(doVerify bool)
- func VerifyPairing(X *Sign, Y *Sign, pub *PublicKey) bool
- func VerifyPublicKeyOrder(doVerify bool)
- func VerifySignatureOrder(doVerify bool)
- type Fp
- func (x *Fp) Clear()
- func (x *Fp) Deserialize(buf []byte) error
- func (x *Fp) GetString(base int) string
- func (x *Fp) IsEqual(rhs *Fp) bool
- func (x *Fp) IsNegative() bool
- func (x *Fp) IsOdd() bool
- func (x *Fp) IsOne() bool
- func (x *Fp) IsValid() bool
- func (x *Fp) IsZero() bool
- func (x *Fp) Serialize() []byte
- func (x *Fp) SetBigEndianMod(buf []byte) error
- func (x *Fp) SetByCSPRNG()
- func (x *Fp) SetHashOf(buf []byte) bool
- func (x *Fp) SetInt64(v int64)
- func (x *Fp) SetLittleEndian(buf []byte) error
- func (x *Fp) SetLittleEndianMod(buf []byte) error
- func (x *Fp) SetString(s string, base int) error
- type Fp2
- type Fr
- func (x *Fr) Clear()
- func (x *Fr) Deserialize(buf []byte) error
- func (x *Fr) GetString(base int) string
- func (x *Fr) IsEqual(rhs *Fr) bool
- func (x *Fr) IsNegative() bool
- func (x *Fr) IsOdd() bool
- func (x *Fr) IsOne() bool
- func (x *Fr) IsValid() bool
- func (x *Fr) IsZero() bool
- func (x *Fr) Serialize() []byte
- func (x *Fr) SetBigEndianMod(buf []byte) error
- func (x *Fr) SetByCSPRNG()
- func (x *Fr) SetHashOf(buf []byte) bool
- func (x *Fr) SetInt64(v int64)
- func (x *Fr) SetLittleEndian(buf []byte) error
- func (x *Fr) SetLittleEndianMod(buf []byte) error
- func (x *Fr) SetString(s string, base int) error
- type G1
- func (x *G1) Clear()
- func (x *G1) Deserialize(buf []byte) error
- func (x *G1) DeserializeUncompressed(buf []byte) error
- func (x *G1) GetString(base int) string
- func (x *G1) HashAndMapTo(buf []byte) error
- func (x *G1) IsEqual(rhs *G1) bool
- func (x *G1) IsValid() bool
- func (x *G1) IsValidOrder() bool
- func (x *G1) IsZero() bool
- func (x *G1) Serialize() []byte
- func (x *G1) SerializeUncompressed() []byte
- func (x *G1) SetString(s string, base int) error
- type G2
- func (x *G2) Clear()
- func (x *G2) Deserialize(buf []byte) error
- func (x *G2) DeserializeUncompressed(buf []byte) error
- func (x *G2) GetString(base int) string
- func (x *G2) HashAndMapTo(buf []byte) error
- func (x *G2) IsEqual(rhs *G2) bool
- func (x *G2) IsValid() bool
- func (x *G2) IsValidOrder() bool
- func (x *G2) IsZero() bool
- func (x *G2) Serialize() []byte
- func (x *G2) SerializeUncompressed() []byte
- func (x *G2) SetString(s string, base int) error
- type GT
- func (x *GT) Clear()
- func (x *GT) Deserialize(buf []byte) error
- func (x *GT) GetString(base int) string
- func (x *GT) IsEqual(rhs *GT) bool
- func (x *GT) IsOne() bool
- func (x *GT) IsZero() bool
- func (x *GT) Serialize() []byte
- func (x *GT) SetInt64(v int64)
- func (x *GT) SetString(s string, base int) error
- type ID
- func (id *ID) Deserialize(buf []byte) error
- func (id *ID) DeserializeHexStr(s string) error
- func (id *ID) GetDecString() string
- func (id *ID) GetHexString() string
- func (id *ID) GetLittleEndian() []byte
- func (id *ID) IsEqual(rhs *ID) bool
- func (id *ID) Serialize() []byte
- func (id *ID) SerializeToHexStr() string
- func (id *ID) SetDecString(s string) error
- func (id *ID) SetHexString(s string) error
- func (id *ID) SetLittleEndian(buf []byte) error
- type PublicKey
- func (pub *PublicKey) Add(rhs *PublicKey)
- func (pub *PublicKey) Deserialize(buf []byte) error
- func (pub *PublicKey) DeserializeHexStr(s string) error
- func (pub *PublicKey) GetHexString() string
- func (pub *PublicKey) IsEqual(rhs *PublicKey) bool
- func (pub *PublicKey) IsValidOrder() bool
- func (pub *PublicKey) IsZero() bool
- func (pub *PublicKey) Recover(pubVec []PublicKey, idVec []ID) error
- func (pub *PublicKey) Serialize() []byte
- func (pub *PublicKey) SerializeToHexStr() string
- func (pub *PublicKey) Set(mpk []PublicKey, id *ID) error
- func (pub *PublicKey) SetHexString(s string) error
- type PublicKeys
- type SecretKey
- func (sec *SecretKey) Add(rhs *SecretKey)
- func (sec *SecretKey) Deserialize(buf []byte) error
- func (sec *SecretKey) DeserializeHexStr(s string) error
- func (sec *SecretKey) GetDecString() string
- func (sec *SecretKey) GetHexString() string
- func (sec *SecretKey) GetLittleEndian() []byte
- func (sec *SecretKey) GetMasterSecretKey(k int) (msk []SecretKey)
- func (sec *SecretKey) GetPop() (sig *Sign)
- func (sec *SecretKey) GetPublicKey() (pub *PublicKey)
- func (sec *SecretKey) GetSafePublicKey() (pub *PublicKey, err error)
- func (sec *SecretKey) IsEqual(rhs *SecretKey) bool
- func (sec *SecretKey) IsZero() bool
- func (sec *SecretKey) Recover(secVec []SecretKey, idVec []ID) error
- func (sec *SecretKey) Serialize() []byte
- func (sec *SecretKey) SerializeToHexStr() string
- func (sec *SecretKey) Set(msk []SecretKey, id *ID) error
- func (sec *SecretKey) SetByCSPRNG()
- func (sec *SecretKey) SetDecString(s string) error
- func (sec *SecretKey) SetHexString(s string) error
- func (sec *SecretKey) SetLittleEndian(buf []byte) error
- func (sec *SecretKey) SetLittleEndianMod(buf []byte) error
- func (sec *SecretKey) Sign(m string) (sig *Sign)
- func (sec *SecretKey) SignByte(msg []byte) (sig *Sign)
- func (sec *SecretKey) SignHash(hash []byte) (sig *Sign)
- type Sign
- func (sig *Sign) Add(rhs *Sign)
- func (sig *Sign) Aggregate(sigVec []Sign)
- func (sig *Sign) Deserialize(buf []byte) error
- func (sig *Sign) DeserializeHexStr(s string) error
- func (sig *Sign) FastAggregateVerify(pubVec []PublicKey, msg []byte) bool
- func (sig *Sign) GetHexString() string
- func (sig *Sign) IsEqual(rhs *Sign) bool
- func (sig *Sign) IsValidOrder() bool
- func (sig *Sign) IsZero() bool
- func (sig *Sign) Recover(sigVec []Sign, idVec []ID) error
- func (sig *Sign) Serialize() []byte
- func (sig *Sign) SerializeToHexStr() string
- func (sig *Sign) SetHexString(s string) error
- func (sig *Sign) Verify(pub *PublicKey, m string) bool
- func (sig *Sign) VerifyAggregateHashes(pubVec []PublicKey, hash [][]byte) bool
- func (sig *Sign) VerifyByte(pub *PublicKey, msg []byte) bool
- func (sig *Sign) VerifyHash(pub *PublicKey, hash []byte) bool
- func (sig *Sign) VerifyPop(pub *PublicKey) bool
Constants ¶
const BLS12_381 = C.MCL_BLS12_381
BLS12_381 --
const CurveFp254BNb = C.mclBn_CurveFp254BNb
CurveFp254BNb -- 254 bit curve
const CurveFp382_1 = C.mclBn_CurveFp382_1
CurveFp382_1 -- 382 bit curve 1
const CurveFp382_2 = C.mclBn_CurveFp382_2
CurveFp382_2 -- 382 bit curve 2
const EthModeDraft05 = C.BLS_ETH_MODE_DRAFT_05
const EthModeDraft06 = C.BLS_ETH_MODE_DRAFT_06
const EthModeDraft07 = C.BLS_ETH_MODE_DRAFT_07
const EthModeLatest = C.BLS_ETH_MODE_LATEST
const EthModeOld = C.BLS_ETH_MODE_OLD
const IO_EC_AFFINE = C.MCLBN_IO_EC_AFFINE
IO_EC_AFFINE --
const IO_EC_PROJ = C.MCLBN_IO_EC_PROJ
IO_EC_PROJ --
const IRTF = 5 /* MCL_MAP_TO_MODE_HASH_TO_CURVE_07 */
IRTF -- for SetMapToMode
const IoSerializeHexStr = C.MCLBN_IO_SERIALIZE_HEX_STR
IoSerializeHexStr --
const ZERO_HEADER = 1 << 6
Variables ¶
This section is empty.
Functions ¶
func BlsGetGeneratorOfPublicKey ¶
func BlsGetGeneratorOfPublicKey(pub *PublicKey)
keep for backward compatibility
func FrEvaluatePolynomial ¶
FrEvaluatePolynomial -- y = c[0] + c[1] * x + c[2] * x^2 + ...
func FrLagrangeInterpolation ¶
FrLagrangeInterpolation --
func G1EvaluatePolynomial ¶
G1EvaluatePolynomial -- y = c[0] + c[1] * x + c[2] * x^2 + ...
func G1LagrangeInterpolation ¶
G1LagrangeInterpolation --
func G2EvaluatePolynomial ¶
G2EvaluatePolynomial -- y = c[0] + c[1] * x + c[2] * x^2 + ...
func G2LagrangeInterpolation ¶
G2LagrangeInterpolation --
func GetFieldOrder ¶
func GetFieldOrder() string
GetFieldOrder -- return the characteristic of the field where a curve is defined
func GetGeneratorOfPublicKey ¶
func GetGeneratorOfPublicKey(pub *PublicKey)
GetGeneratorOfPublicKey -
func GetOpUnitSize ¶
func GetOpUnitSize() int
GetOpUnitSize -- the length of Fr is GetOpUnitSize() * 8 bytes
func Init ¶
Init -- call this function before calling all the other operations this function is not thread safe
func MillerLoopVec ¶
MillerLoopVec -- multi pairings ; out = prod_i e(xVec[i], yVec[i])
func PrecomputedMillerLoop ¶
PrecomputedMillerLoop --
func PrecomputedMillerLoop2 ¶
PrecomputedMillerLoop2 --
func SetGeneratorOfPublicKey ¶
SetGeneratorOfPublicKey -
func SignatureVerifyOrder ¶
func SignatureVerifyOrder(doVerify bool)
SignatureVerifyOrder -- check the correctness of the order of signature in deserialize if true
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) SetLittleEndianMod ¶
SetLittleEndianMod --
type Fr ¶
type Fr struct {
// contains filtered or unexported fields
}
Fr --
func CastFromSecretKey ¶
func (*Fr) SetLittleEndianMod ¶
SetLittleEndianMod --
type G1 ¶
G1 --
func CastFromSign ¶
func (*G1) DeserializeUncompressed ¶
DeserializeUncompressed -- x.Deserialize() + y.Deserialize()
func (*G1) SerializeUncompressed ¶
SerializeUncompressed -- all zero array if x.IsZero()
type G2 ¶
G2 --
func CastFromPublicKey ¶
func (*G2) DeserializeUncompressed ¶
DeserializeUncompressed -- x.Deserialize() + y.Deserialize()
func (*G2) SerializeUncompressed ¶
SerializeUncompressed -- all zero array if x.IsZero()
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID --
func (*ID) GetLittleEndian ¶
GetLittleEndian -- alias of Serialize
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey --
func CastToPublicKey ¶
func DHKeyExchange ¶
DHKeyExchange --
func GetMasterPublicKey ¶
GetMasterPublicKey --
func (*PublicKey) DeserializeHexStr ¶
DeserializeHexStr --
func (*PublicKey) SerializeToHexStr ¶
SerializeToHexStr --
type PublicKeys ¶
type PublicKeys []PublicKey
PublicKeys ..
func (PublicKeys) JSON ¶
func (keys PublicKeys) JSON() string
JSON provides a JSON string dump of slice of PublicKeys in Hexformat
type SecretKey ¶
type SecretKey struct {
// contains filtered or unexported fields
}
SecretKey --
func CastToSecretKey ¶
func (*SecretKey) DeserializeHexStr ¶
DeserializeHexStr --
func (*SecretKey) GetLittleEndian ¶
GetLittleEndian -- alias of Serialize
func (*SecretKey) GetMasterSecretKey ¶
GetMasterSecretKey --
func (*SecretKey) GetPublicKey ¶
GetPublicKey --
func (*SecretKey) GetSafePublicKey ¶
GetSafePublicKey -- error if sec is zero
func (*SecretKey) SerializeToHexStr ¶
SerializeToHexStr --
func (*SecretKey) SetLittleEndian ¶
SetLittleEndian --
func (*SecretKey) SetLittleEndianMod ¶
SetLittleEndianMod --
type Sign ¶
type Sign struct {
// contains filtered or unexported fields
}
Sign --
func CastToSign ¶
func (*Sign) DeserializeHexStr ¶
DeserializeHexStr --
func (*Sign) FastAggregateVerify ¶
FastAggregateVerify --
func (*Sign) VerifyAggregateHashes ¶
VerifyAggregateHashes --
func (*Sign) VerifyByte ¶
VerifyByte --
func (*Sign) VerifyHash ¶
VerifyHash --