Documentation
¶
Index ¶
- Variables
- func NewBLS12381Suite() pairing.Suite
- func NewGroupG1() kyber.Group
- func NewGroupG2() kyber.Group
- func NewGroupGT() kyber.Group
- func NewKyberScalar() kyber.Scalar
- type E
- type Engine
- type G1
- func (g *G1) Add(r, p1, p2 *PointG1) *PointG1
- func (g *G1) Affine(p *PointG1) *PointG1
- func (g *G1) ClearCofactor(p *PointG1)
- func (g *G1) Copy(dst *PointG1, src *PointG1) *PointG1
- func (g *G1) Double(r, p *PointG1) *PointG1
- func (g *G1) EncodeToPoint(msg, domain []byte) (*PointG1, error)
- func (g *G1) Equal(p1, p2 *PointG1) bool
- func (g *G1) FromBytes(in []byte) (*PointG1, error)
- func (g *G1) FromCompressed(compressed []byte) (*PointG1, error)
- func (g *G1) FromUncompressed(uncompressed []byte) (*PointG1, error)
- func (g *G1) HashToCurve(msg, domain []byte) (*PointG1, error)
- func (g *G1) InCorrectSubgroup(p *PointG1) bool
- func (g *G1) IsAffine(p *PointG1) bool
- func (g *G1) IsOnCurve(p *PointG1) bool
- func (g *G1) IsZero(p *PointG1) bool
- func (g *G1) MapToCurve(in []byte) (*PointG1, error)
- func (g *G1) MulByCofactor(c, p *PointG1)
- func (g *G1) MulScalar(c, p *PointG1, e *big.Int) *PointG1
- func (g *G1) MultiExp(r *PointG1, points []*PointG1, powers []*big.Int) (*PointG1, error)
- func (g *G1) Neg(r, p *PointG1) *PointG1
- func (g *G1) New() *PointG1
- func (g *G1) One() *PointG1
- func (g *G1) Q() *big.Int
- func (g *G1) Sub(c, a, b *PointG1) *PointG1
- func (g *G1) ToBytes(p *PointG1) []byte
- func (g *G1) ToCompressed(p *PointG1) []byte
- func (g *G1) ToUncompressed(p *PointG1) []byte
- func (g *G1) Zero() *PointG1
- type G2
- func (g *G2) Add(r, p1, p2 *PointG2) *PointG2
- func (g *G2) Affine(p *PointG2) *PointG2
- func (g *G2) ClearCofactor(p *PointG2)
- func (g *G2) Copy(dst *PointG2, src *PointG2) *PointG2
- func (g *G2) Double(r, p *PointG2) *PointG2
- func (g *G2) EncodeToCurve(msg, domain []byte) (*PointG2, error)
- func (g *G2) Equal(p1, p2 *PointG2) bool
- func (g *G2) FromBytes(in []byte) (*PointG2, error)
- func (g *G2) FromCompressed(compressed []byte) (*PointG2, error)
- func (g *G2) FromUncompressed(uncompressed []byte) (*PointG2, error)
- func (g *G2) HashToCurve(msg, domain []byte) (*PointG2, error)
- func (g *G2) InCorrectSubgroup(p *PointG2) bool
- func (g *G2) IsAffine(p *PointG2) bool
- func (g *G2) IsOnCurve(p *PointG2) bool
- func (g *G2) IsZero(p *PointG2) bool
- func (g *G2) MulScalar(c, p *PointG2, e *big.Int) *PointG2
- func (g *G2) MultiExp(r *PointG2, points []*PointG2, powers []*big.Int) (*PointG2, error)
- func (g *G2) Neg(r, p *PointG2) *PointG2
- func (g *G2) New() *PointG2
- func (g *G2) One() *PointG2
- func (g *G2) Q() *big.Int
- func (g *G2) Sub(c, a, b *PointG2) *PointG2
- func (g *G2) ToBytes(p *PointG2) []byte
- func (g *G2) ToCompressed(p *PointG2) []byte
- func (g *G2) ToUncompressed(p *PointG2) []byte
- func (g *G2) Zero() *PointG2
- type GT
- func (g *GT) Add(c, a, b *E)
- func (g *GT) Copy(a, b *E)
- func (g *GT) Equal(a, b *E) bool
- func (g *GT) Exp(c, a *E, s *big.Int)
- func (g *GT) FromBytes(in []byte) (*E, error)
- func (g *GT) Inverse(c, a *E)
- func (g *GT) IsOne(e *E) bool
- func (g *GT) IsValid(e *E) bool
- func (g *GT) Mul(c, a, b *E)
- func (g *GT) New() *E
- func (g *GT) One() *E
- func (g *GT) Q() *big.Int
- func (g *GT) Square(c, a *E)
- func (g *GT) Sub(c, a, b *E)
- func (g *GT) ToBytes(e *E) []byte
- type KyberG1
- func (k *KyberG1) Add(a, b kyber.Point) kyber.Point
- func (k *KyberG1) Base() kyber.Point
- func (k *KyberG1) Clone() kyber.Point
- func (k *KyberG1) Data() ([]byte, error)
- func (k *KyberG1) Embed(data []byte, rand cipher.Stream) kyber.Point
- func (k *KyberG1) EmbedLen() int
- func (k *KyberG1) Equal(k2 kyber.Point) bool
- func (k *KyberG1) Hash(m []byte) kyber.Point
- func (k *KyberG1) MarshalBinary() ([]byte, error)
- func (k *KyberG1) MarshalSize() int
- func (k *KyberG1) MarshalTo(w io.Writer) (int, error)
- func (k *KyberG1) Mul(s kyber.Scalar, q kyber.Point) kyber.Point
- func (k *KyberG1) Neg(a kyber.Point) kyber.Point
- func (k *KyberG1) Null() kyber.Point
- func (k *KyberG1) Pick(rand cipher.Stream) kyber.Point
- func (k *KyberG1) Set(q kyber.Point) kyber.Point
- func (k *KyberG1) String() string
- func (k *KyberG1) Sub(a, b kyber.Point) kyber.Point
- func (k *KyberG1) UnmarshalBinary(buff []byte) error
- func (k *KyberG1) UnmarshalFrom(r io.Reader) (int, error)
- type KyberG2
- func (k *KyberG2) Add(a, b kyber.Point) kyber.Point
- func (k *KyberG2) Base() kyber.Point
- func (k *KyberG2) Clone() kyber.Point
- func (k *KyberG2) Data() ([]byte, error)
- func (k *KyberG2) Embed(data []byte, rand cipher.Stream) kyber.Point
- func (k *KyberG2) EmbedLen() int
- func (k *KyberG2) Equal(k2 kyber.Point) bool
- func (k *KyberG2) Hash(m []byte) kyber.Point
- func (k *KyberG2) MarshalBinary() ([]byte, error)
- func (k *KyberG2) MarshalSize() int
- func (k *KyberG2) MarshalTo(w io.Writer) (int, error)
- func (k *KyberG2) Mul(s kyber.Scalar, q kyber.Point) kyber.Point
- func (k *KyberG2) Neg(a kyber.Point) kyber.Point
- func (k *KyberG2) Null() kyber.Point
- func (k *KyberG2) Pick(rand cipher.Stream) kyber.Point
- func (k *KyberG2) Set(q kyber.Point) kyber.Point
- func (k *KyberG2) String() string
- func (k *KyberG2) Sub(a, b kyber.Point) kyber.Point
- func (k *KyberG2) UnmarshalBinary(buff []byte) error
- func (k *KyberG2) UnmarshalFrom(r io.Reader) (int, error)
- type KyberGT
- func (k *KyberGT) Add(a, b kyber.Point) kyber.Point
- func (k *KyberGT) Base() kyber.Point
- func (k *KyberGT) Clone() kyber.Point
- func (k *KyberGT) Data() ([]byte, error)
- func (k *KyberGT) Embed(data []byte, rand cipher.Stream) kyber.Point
- func (k *KyberGT) EmbedLen() int
- func (k *KyberGT) Equal(kk kyber.Point) bool
- func (k *KyberGT) MarshalBinary() ([]byte, error)
- func (k *KyberGT) MarshalSize() int
- func (k *KyberGT) MarshalTo(w io.Writer) (int, error)
- func (k *KyberGT) Mul(s kyber.Scalar, q kyber.Point) kyber.Point
- func (k *KyberGT) Neg(q kyber.Point) kyber.Point
- func (k *KyberGT) Null() kyber.Point
- func (k *KyberGT) Pick(rand cipher.Stream) kyber.Point
- func (k *KyberGT) Set(q kyber.Point) kyber.Point
- func (k *KyberGT) String() string
- func (k *KyberGT) Sub(a, b kyber.Point) kyber.Point
- func (k *KyberGT) UnmarshalBinary(buf []byte) error
- func (k *KyberGT) UnmarshalFrom(r io.Reader) (int, error)
- type PointG1
- type PointG2
- type Suite
- func (s *Suite) G1() kyber.Group
- func (s *Suite) G2() kyber.Group
- func (s *Suite) GT() kyber.Group
- func (s *Suite) Hash() hash.Hash
- func (s *Suite) New(t reflect.Type) interface{}
- func (s *Suite) Pair(p1, p2 kyber.Point) kyber.Point
- func (s *Suite) RandomStream() cipher.Stream
- func (s *Suite) Read(r io.Reader, objs ...interface{}) error
- func (s *Suite) Write(w io.Writer, objs ...interface{}) error
- func (s *Suite) XOF(seed []byte) kyber.XOF
Constants ¶
This section is empty.
Variables ¶
var Domain = []byte("BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_")
Domain comes from the ciphersuite used by the RFC of this name compatible with the paired library > v18
var G1One = g1One
var G2One = g2One
Functions ¶
func NewBLS12381Suite ¶
func NewGroupG1 ¶
func NewGroupG2 ¶
func NewGroupGT ¶
func NewKyberScalar ¶
Types ¶
type Engine ¶ added in v0.2.0
Engine is BLS12-381 elliptic curve pairing engine
func NewEngine ¶ added in v0.2.0
func NewEngine() *Engine
NewEngine creates new pairing engine insteace.
func (*Engine) AddPairInv ¶ added in v0.2.0
AddPairInv adds a G1, G2 point pair to pairing engine. G1 point is negated.
type G1 ¶
type G1 struct {
// contains filtered or unexported fields
}
G1 is struct for G1 group.
func (*G1) Affine ¶
Add adds two G1 points p1, p2 and assigns the result to point at first argument.
func (*G1) ClearCofactor ¶ added in v0.2.0
ClearCofactor maps given a G1 point to correct subgroup
func (*G1) Double ¶
Double doubles a G1 point p and assigns the result to the point at first argument.
func (*G1) EncodeToPoint ¶ added in v0.3.0
EncodeToCurve given a message and domain seperator tag returns the hash result which is a valid curve point. Implementation follows BLS12381G1_XMD:SHA-256_SSWU_NU_ suite at https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06
func (*G1) FromBytes ¶ added in v0.2.0
FromBytes constructs a new point given uncompressed byte input. FromBytes does not take zcash flags into account. Byte input expected to be larger than 96 bytes. First 96 bytes should be concatenation of x and y values. Point (0, 0) is considered as infinity.
func (*G1) FromCompressed ¶
FromCompressed expects byte slice larger than 96 bytes and given bytes returns a new point in G1. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
func (*G1) FromUncompressed ¶
FromUncompressed expects byte slice larger than 96 bytes and given bytes returns a new point in G1. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
func (*G1) HashToCurve ¶ added in v0.3.0
HashToCurve given a message and domain seperator tag returns the hash result which is a valid curve point. Implementation follows BLS12381G1_XMD:SHA-256_SSWU_RO_ suite at https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06
func (*G1) InCorrectSubgroup ¶ added in v0.2.0
InCorrectSubgroup checks whether given point is in correct subgroup.
func (*G1) MapToCurve ¶ added in v0.3.0
MapToCurve given a byte slice returns a valid G1 point. This mapping function implements the Simplified Shallue-van de Woestijne-Ulas method. https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06 Input byte slice should be a valid field element, otherwise an error is returned.
func (*G1) MulByCofactor ¶
func (*G1) MulScalar ¶
MulScalar multiplies a point by given scalar value in big.Int and assigns the result to point at first argument.
func (*G1) MultiExp ¶ added in v0.2.0
MultiExp calculates multi exponentiation. Given pairs of G1 point and scalar values (P_0, e_0), (P_1, e_1), ... (P_n, e_n) calculates r = e_0 * P_0 + e_1 * P_1 + ... + e_n * P_n Length of points and scalars are expected to be equal, otherwise an error is returned. Result is assigned to point at first argument.
func (*G1) New ¶ added in v0.2.0
New creates a new G1 Point which is equal to zero in other words point at infinity.
func (*G1) Sub ¶
Sub subtracts two G1 points p1, p2 and assigns the result to point at first argument.
func (*G1) ToBytes ¶ added in v0.2.0
ToBytes serializes a point into bytes in uncompressed form. ToBytes does not take zcash flags into account. ToBytes returns (0, 0) if point is infinity.
func (*G1) ToCompressed ¶
ToCompressed given a G1 point returns bytes in compressed form of the point. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
func (*G1) ToUncompressed ¶
ToUncompressed given a G1 point returns bytes in uncompressed (x, y) form of the point. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
type G2 ¶
type G2 struct {
// contains filtered or unexported fields
}
G2 is struct for G2 group.
func (*G2) ClearCofactor ¶ added in v0.2.0
ClearCofactor maps given a G2 point to correct subgroup
func (*G2) Double ¶
Double doubles a G2 point p and assigns the result to the point at first argument.
func (*G2) EncodeToCurve ¶ added in v0.3.0
EncodeToCurve given a message and domain seperator tag returns the hash result which is a valid curve point. Implementation follows BLS12381G1_XMD:SHA-256_SSWU_NU_ suite at https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06
func (*G2) FromBytes ¶ added in v0.2.0
FromBytes constructs a new point given uncompressed byte input. FromBytes does not take zcash flags into account. Byte input expected to be larger than 96 bytes. First 192 bytes should be concatenation of x and y values Point (0, 0) is considered as infinity.
func (*G2) FromCompressed ¶
FromCompressed expects byte slice larger than 96 bytes and given bytes returns a new point in G2. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
func (*G2) FromUncompressed ¶
FromUncompressed expects byte slice larger than 192 bytes and given bytes returns a new point in G2. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
func (*G2) HashToCurve ¶ added in v0.3.0
HashToCurve given a message and domain seperator tag returns the hash result which is a valid curve point. Implementation follows BLS12381G1_XMD:SHA-256_SSWU_RO_ suite at https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06
func (*G2) InCorrectSubgroup ¶ added in v0.2.0
InCorrectSubgroup checks whether given point is in correct subgroup.
func (*G2) MulScalar ¶
MulScalar multiplies a point by given scalar value in big.Int and assigns the result to point at first argument.
func (*G2) MultiExp ¶ added in v0.2.0
MultiExp calculates multi exponentiation. Given pairs of G2 point and scalar values (P_0, e_0), (P_1, e_1), ... (P_n, e_n) calculates r = e_0 * P_0 + e_1 * P_1 + ... + e_n * P_n Length of points and scalars are expected to be equal, otherwise an error is returned. Result is assigned to point at first argument.
func (*G2) New ¶ added in v0.2.0
New creates a new G2 Point which is equal to zero in other words point at infinity.
func (*G2) Sub ¶
Sub subtracts two G2 points p1, p2 and assigns the result to point at first argument.
func (*G2) ToBytes ¶ added in v0.2.0
ToBytes serializes a point into bytes in uncompressed form, does not take zcash flags into account, returns (0, 0) if point is infinity.
func (*G2) ToCompressed ¶
ToCompressed given a G2 point returns bytes in compressed form of the point. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
func (*G2) ToUncompressed ¶
ToUncompressed given a G2 point returns bytes in uncompressed (x, y) form of the point. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
type GT ¶ added in v0.2.0
type GT struct {
// contains filtered or unexported fields
}
GT is type for target multiplicative group GT.
func (*GT) Add ¶ added in v0.2.0
Add adds two field element `a` and `b` and assigns the result to the element in first argument.
func (*GT) Equal ¶ added in v0.2.0
Equal returns true if given two element is equal, otherwise returns false
func (*GT) Exp ¶ added in v0.2.0
Exp exponents an element `a` by a scalar `s` and assigns the result to the element in first argument.
func (*GT) FromBytes ¶ added in v0.2.0
FromBytes expects 576 byte input and returns target group element FromBytes returns error if given element is not on correct subgroup.
func (*GT) Inverse ¶ added in v0.2.0
Inverse inverses an element `a` and assigns the result to the element in first argument.
func (*GT) IsValid ¶ added in v0.2.0
IsValid checks whether given target group element is in correct subgroup.
func (*GT) Mul ¶ added in v0.2.0
Mul multiplies two field element `a` and `b` and assigns the result to the element in first argument.
func (*GT) Square ¶ added in v0.2.0
Square squares an element `a` and assigns the result to the element in first argument.
type KyberG1 ¶
type KyberG1 struct {
// contains filtered or unexported fields
}
KyberG1 is a kyber.Point holding a G1 point on BLS12-381 curve
func (*KyberG1) MarshalBinary ¶
func (*KyberG1) MarshalSize ¶
func (*KyberG1) UnmarshalBinary ¶
type KyberG2 ¶
type KyberG2 struct {
// contains filtered or unexported fields
}
KyberG2 is a kyber.Point holding a G2 point on BLS12-381 curve
func (*KyberG2) MarshalBinary ¶
func (*KyberG2) MarshalSize ¶
func (*KyberG2) UnmarshalBinary ¶
type KyberGT ¶
type KyberGT struct {
// contains filtered or unexported fields
}
func (*KyberGT) MarshalBinary ¶
func (*KyberGT) MarshalSize ¶
func (*KyberGT) UnmarshalBinary ¶
type PointG1 ¶
type PointG1 [3]fe
PointG1 is type for point in G1. PointG1 is both used for Affine and Jacobian point representation. If z is equal to one the point is accounted as in affine form.
type PointG2 ¶
type PointG2 [3]fe2
PointG2 is type for point in G2. PointG2 is both used for Affine and Jacobian point representation. If z is equal to one the point is accounted as in affine form.
type Suite ¶
type Suite struct { }
func (*Suite) RandomStream ¶
RandomStream returns a cipher.Stream which corresponds to a key stream from crypto/rand.