Documentation ¶
Index ¶
- Constants
- func BatchVerifyDistinctMsg(curve int, pkVec []PublicKey, msgVec []Sign, sign Sign) error
- func BatchVerifySameMsg(curve int, msg string, pkVec []PublicKey, sign Sign) error
- 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 G2IsValid(rhs *PublicKey) bool
- 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 SaveBLS(file string, key *SecretKey) error
- func SchnorrNIZKVerify(curve int, proof Proof, P PublicKey) error
- func Schnorr_test(curve int, r, c SecretKey, G, V, P PublicKey) error
- 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
- type Proofdeprecated
- type PublicKey
- func DHKeyExchange(sec *SecretKey, pub *PublicKey) (out PublicKey)
- func GetGeneratorOfG2() (pub *PublicKey)
- func GetMasterPublicKey(msk []SecretKey) (mpk []PublicKey)
- func PubkeyBatchAdd(pkVec []PublicKey) (pub PublicKey)
- func SynthSameMsg(curve int, pkVec []PublicKey, mVec []string) ([]PublicKey, []string, []string, error)
- func (pub *PublicKey) Add(rhs *PublicKey)
- func (pub *PublicKey) DecodeRLP(s *rlp.Stream) error
- func (pub *PublicKey) Deserialize(buf []byte) error
- func (pub *PublicKey) EncodeRLP(w io.Writer) error
- func (pub *PublicKey) GetHexString() string
- func (pub *PublicKey) IsEqual(rhs *PublicKey) bool
- func (pub *PublicKey) MarshalText() ([]byte, error)
- func (pub *PublicKey) Mul(rhs *SecretKey)
- func (pub *PublicKey) Recover(pubVec []PublicKey, idVec []ID) error
- func (pub *PublicKey) Serialize() []byte
- func (pub *PublicKey) Set(mpk []PublicKey, id *ID) error
- func (pub *PublicKey) SetHexString(s string) error
- func (pub *PublicKey) UnmarshalText(text []byte) error
- type PublicKeyHex
- type SchnorrProof
- func (pf *SchnorrProof) DecodeRLP(s *rlp.Stream) error
- func (pf *SchnorrProof) Deserialize(buf []byte) error
- func (pf *SchnorrProof) EncodeRLP(w io.Writer) error
- func (pf *SchnorrProof) MarshalText() ([]byte, error)
- func (pf *SchnorrProof) Serialize() []byte
- func (pf *SchnorrProof) UnmarshalText(text []byte) error
- func (sig *SchnorrProof) VerifySchnorrNIZK(pk PublicKey) error
- type SchnorrProofHex
- type SecretKey
- func (sec *SecretKey) Add(rhs *SecretKey)
- func (sec *SecretKey) Deserialize(buf []byte) 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() (sign *Sign)
- func (sec *SecretKey) GetPublicKey() (pub *PublicKey)
- func (sec *SecretKey) IsEqual(rhs *SecretKey) bool
- func (sec *SecretKey) MakeSchnorrNIZKP() (*SchnorrProof, error)
- func (sec *SecretKey) Mul(rhs *SecretKey)
- func (sec *SecretKey) Recover(secVec []SecretKey, idVec []ID) error
- func (sec *SecretKey) Serialize() []byte
- 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) (sign *Sign)
- func (sec *SecretKey) Sub(rhs *SecretKey)
- type Sign
- func (sign *Sign) Add(rhs *Sign)
- func (sign *Sign) Deserialize(buf []byte) error
- func (sign *Sign) GetHexString() string
- func (sign *Sign) IsEqual(rhs *Sign) bool
- func (sign *Sign) Recover(signVec []Sign, idVec []ID) error
- func (sign *Sign) Serialize() []byte
- func (sign *Sign) SetHexString(s string) error
- func (sign *Sign) Verify(pub *PublicKey, m string) bool
- func (sign *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 BatchVerifyDistinctMsg ¶
func BatchVerifySameMsg ¶
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 GT ¶
type GT struct {
// contains filtered or unexported fields
}
GT --
func GTBatchAdd ¶
func GTBatchMul ¶
type Proof
deprecated
type Proof struct {
C, R SecretKey
}
Deprecated: use SchnorrProof
func (*Proof) MarshalText ¶
func (*Proof) UnmarshalText ¶
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey --
func DHKeyExchange ¶
DHKeyExchange --
func GetMasterPublicKey ¶
GetMasterPublicKey --
func SynthSameMsg ¶
func (*PublicKey) MarshalText ¶
func (*PublicKey) UnmarshalText ¶
type PublicKeyHex ¶
type PublicKeyHex [96]byte
Match only 192 hex char length public keys
func (PublicKeyHex) Bytes ¶
func (pe PublicKeyHex) Bytes() []byte
func (PublicKeyHex) MarshalText ¶
func (pe PublicKeyHex) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*PublicKeyHex) ParseBlsPubKey ¶
func (pe *PublicKeyHex) ParseBlsPubKey() (*PublicKey, error)
func (PublicKeyHex) String ¶
func (pe PublicKeyHex) String() string
func (*PublicKeyHex) UnmarshalText ¶
func (pe *PublicKeyHex) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type SchnorrProof ¶
type SchnorrProof struct {
C, R SecretKey
}
func (*SchnorrProof) Deserialize ¶
func (pf *SchnorrProof) Deserialize(buf []byte) error
Deserialize --
func (*SchnorrProof) MarshalText ¶
func (pf *SchnorrProof) MarshalText() ([]byte, error)
func (*SchnorrProof) UnmarshalText ¶
func (pf *SchnorrProof) UnmarshalText(text []byte) error
func (*SchnorrProof) VerifySchnorrNIZK ¶
func (sig *SchnorrProof) VerifySchnorrNIZK(pk PublicKey) error
type SchnorrProofHex ¶
type SchnorrProofHex [64]byte
Match only 128 hex char length proof
func (SchnorrProofHex) MarshalText ¶
func (pfe SchnorrProofHex) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (SchnorrProofHex) String ¶
func (pfe SchnorrProofHex) String() string
func (*SchnorrProofHex) UnmarshalText ¶
func (pfe *SchnorrProofHex) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type SecretKey ¶
type SecretKey struct {
// contains filtered or unexported fields
}
SecretKey --
func GenerateKey ¶
func GenerateKey() *SecretKey
func (*SecretKey) GetLittleEndian ¶
GetLittleEndian --
func (*SecretKey) GetMasterSecretKey ¶
GetMasterSecretKey --
func (*SecretKey) GetPublicKey ¶
GetPublicKey --
func (*SecretKey) MakeSchnorrNIZKP ¶
func (sec *SecretKey) MakeSchnorrNIZKP() (*SchnorrProof, error)
func (*SecretKey) SetLittleEndian ¶
SetLittleEndian --
type Sign ¶
type Sign struct {
// contains filtered or unexported fields
}
Sign --