Documentation ¶
Index ¶
- Constants
- func FinalExp(out *GT, x *GT)
- 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 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 G1Neg(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 G2Neg(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 GetFpUnitSize() int
- func GetFrUnitSize() int
- func GetMaxOpUnitSize() int
- func GetOpUnitSize() int
- func GetUint64NumToPrecompute() int
- func Init(curve int) error
- func MillerLoop(out *GT, x *G1, y *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 SetRandFunc(randReader io.Reader)
- func VerifyPairing(X *Sign, Y *Sign, pub *PublicKey) bool
- 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) IsOne() bool
- func (x *Fr) IsZero() bool
- func (x *Fr) Serialize() []byte
- 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) SetString(s string, base int) error
- type G1
- type G2
- 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) 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 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) IsEqual(rhs *SecretKey) 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) Sign(m string) (sig *Sign)
- func (sec *SecretKey) SignHash(hash []byte) (sig *Sign)
- type Sign
- func (sig *Sign) Add(rhs *Sign)
- func (sig *Sign) Deserialize(buf []byte) error
- func (sig *Sign) DeserializeHexStr(s string) error
- func (sig *Sign) GetHexString() string
- func (sig *Sign) IsEqual(rhs *Sign) 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) 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 IoSerializeHexStr = C.MCLBN_IO_SERIALIZE_HEX_STR
IoSerializeHexStr
Variables ¶
This section is empty.
Functions ¶
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 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 PrecomputedMillerLoop ¶
PrecomputedMillerLoop --
func PrecomputedMillerLoop2 ¶
PrecomputedMillerLoop2 --
Types ¶
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 DHKeyExchange ¶
DHKeyExchange --
func GetMasterPublicKey ¶
GetMasterPublicKey --
func GetPublicKey ¶
func (*PublicKey) DeserializeHexStr ¶
DeserializeHexStr --
func (*PublicKey) Serialize ¶
var m_cacheBlsPubs = make(map[string]*PublicKey)
func GetPublicKey(buf []byte) *PublicKey { key := string(buf) pub, ok := m_cacheBlsPubs[key] if ok { return pub } pub = &PublicKey{} if err := pub.Deserialize(buf); err != nil { //log.Debug("bls.PublicKey.Deserialize", "invalid public key", key, "error", err) return nil } m_cacheBlsPubs[key] = pub return pub }
Serialize --
func (*PublicKey) SerializeToHexStr ¶
SerializeToHexStr --
type SecretKey ¶
type SecretKey struct {
// contains filtered or unexported fields
}
SecretKey --
func (*SecretKey) DeserializeHexStr ¶
DeserializeHexStr --
func (*SecretKey) GetLittleEndian ¶
GetLittleEndian -- alias of Serialize
func (*SecretKey) GetMasterSecretKey ¶
GetMasterSecretKey --
func (*SecretKey) GetPublicKey ¶
GetPublicKey --
func (*SecretKey) SerializeToHexStr ¶
SerializeToHexStr --
func (*SecretKey) SetLittleEndian ¶
SetLittleEndian --
type Sign ¶
type Sign struct {
// contains filtered or unexported fields
}
Sign --
func (*Sign) DeserializeHexStr ¶
DeserializeHexStr --
func (*Sign) VerifyAggregateHashes ¶
VerifyAggregateHashes --
func (*Sign) VerifyHash ¶
VerifyHash --