From 04cbb85ecb59e47bf5772eac2ec280f0844cdb66 Mon Sep 17 00:00:00 2001 From: matteosz Date: Wed, 28 Feb 2024 16:55:39 +0100 Subject: [PATCH] Changed kilic naming convention to match circl --- pairing/kilic_bls12381/g1.go | 78 ++++++++++++++-------------- pairing/kilic_bls12381/g2.go | 78 ++++++++++++++-------------- pairing/kilic_bls12381/group.go | 6 +-- pairing/kilic_bls12381/gt.go | 60 ++++++++++----------- pairing/kilic_bls12381/scalar.go | 2 +- pairing/kilic_bls12381/suite.go | 14 ++--- pairing/kilic_bls12381/suite_test.go | 22 ++++---- 7 files changed, 130 insertions(+), 130 deletions(-) diff --git a/pairing/kilic_bls12381/g1.go b/pairing/kilic_bls12381/g1.go index 42327c27e..ec25a82e9 100644 --- a/pairing/kilic_bls12381/g1.go +++ b/pairing/kilic_bls12381/g1.go @@ -18,8 +18,8 @@ func DefaultDomainG1() []byte { return domainG1 } -// KyberG1 is a kyber.Point holding a G1 point on BLS12-381 curve -type KyberG1 struct { +// G1Elt is a kyber.Point holding a G1 point on BLS12-381 curve +type G1Elt struct { p *bls12381.PointG1 // domain separation tag. We treat a 0 len dst as the default value as per the RFC "Tags MUST have nonzero length" dst []byte @@ -28,93 +28,93 @@ type KyberG1 struct { kyber.HashablePoint } -func NullKyberG1(dst ...byte) *KyberG1 { +func NullG1(dst ...byte) *G1Elt { var p bls12381.PointG1 - return newKyberG1(&p, dst) + return newG1(&p, dst) } -func newKyberG1(p *bls12381.PointG1, dst []byte) *KyberG1 { +func newG1(p *bls12381.PointG1, dst []byte) *G1Elt { domain := dst if bytes.Equal(dst, domainG1) { domain = nil } - return &KyberG1{p: p, dst: domain} + return &G1Elt{p: p, dst: domain} } -func (k *KyberG1) Equal(k2 kyber.Point) bool { - k2g1, ok := k2.(*KyberG1) +func (k *G1Elt) Equal(k2 kyber.Point) bool { + k2g1, ok := k2.(*G1Elt) if !ok { return false } return bls12381.NewG1().Equal(k.p, k2g1.p) && bytes.Equal(k.dst, k2g1.dst) } -func (k *KyberG1) Null() kyber.Point { - return newKyberG1(bls12381.NewG1().Zero(), k.dst) +func (k *G1Elt) Null() kyber.Point { + return newG1(bls12381.NewG1().Zero(), k.dst) } -func (k *KyberG1) Base() kyber.Point { - return newKyberG1(bls12381.NewG1().One(), k.dst) +func (k *G1Elt) Base() kyber.Point { + return newG1(bls12381.NewG1().One(), k.dst) } -func (k *KyberG1) Pick(rand cipher.Stream) kyber.Point { +func (k *G1Elt) Pick(rand cipher.Stream) kyber.Point { var dst, src [32]byte rand.XORKeyStream(dst[:], src[:]) return k.Hash(dst[:]) } -func (k *KyberG1) Set(q kyber.Point) kyber.Point { - k.p.Set(q.(*KyberG1).p) +func (k *G1Elt) Set(q kyber.Point) kyber.Point { + k.p.Set(q.(*G1Elt).p) return k } -func (k *KyberG1) Clone() kyber.Point { +func (k *G1Elt) Clone() kyber.Point { var p bls12381.PointG1 p.Set(k.p) - return newKyberG1(&p, k.dst) + return newG1(&p, k.dst) } -func (k *KyberG1) EmbedLen() int { +func (k *G1Elt) EmbedLen() int { panic("bls12-381: unsupported operation") } -func (k *KyberG1) Embed(data []byte, rand cipher.Stream) kyber.Point { +func (k *G1Elt) Embed(data []byte, rand cipher.Stream) kyber.Point { panic("bls12-381: unsupported operation") } -func (k *KyberG1) Data() ([]byte, error) { +func (k *G1Elt) Data() ([]byte, error) { panic("bls12-381: unsupported operation") } -func (k *KyberG1) Add(a, b kyber.Point) kyber.Point { - aa := a.(*KyberG1) - bb := b.(*KyberG1) +func (k *G1Elt) Add(a, b kyber.Point) kyber.Point { + aa := a.(*G1Elt) + bb := b.(*G1Elt) bls12381.NewG1().Add(k.p, aa.p, bb.p) return k } -func (k *KyberG1) Sub(a, b kyber.Point) kyber.Point { - aa := a.(*KyberG1) - bb := b.(*KyberG1) +func (k *G1Elt) Sub(a, b kyber.Point) kyber.Point { + aa := a.(*G1Elt) + bb := b.(*G1Elt) bls12381.NewG1().Sub(k.p, aa.p, bb.p) return k } -func (k *KyberG1) Neg(a kyber.Point) kyber.Point { - aa := a.(*KyberG1) +func (k *G1Elt) Neg(a kyber.Point) kyber.Point { + aa := a.(*G1Elt) bls12381.NewG1().Neg(k.p, aa.p) return k } -func (k *KyberG1) Mul(s kyber.Scalar, q kyber.Point) kyber.Point { +func (k *G1Elt) Mul(s kyber.Scalar, q kyber.Point) kyber.Point { if q == nil { - q = NullKyberG1(k.dst...).Base() + q = NullG1(k.dst...).Base() } - bls12381.NewG1().MulScalarBig(k.p, q.(*KyberG1).p, &s.(*mod.Int).V) + bls12381.NewG1().MulScalarBig(k.p, q.(*G1Elt).p, &s.(*mod.Int).V) return k } // MarshalBinary returns a compressed point, without any domain separation tag information -func (k *KyberG1) MarshalBinary() ([]byte, error) { +func (k *G1Elt) MarshalBinary() ([]byte, error) { // we need to clone the point because of https://github.com/kilic/bls12-381/issues/37 // in order to avoid risks of race conditions. t := new(bls12381.PointG1).Set(k.p) @@ -122,14 +122,14 @@ func (k *KyberG1) MarshalBinary() ([]byte, error) { } // UnmarshalBinary populates the point from a compressed point representation. -func (k *KyberG1) UnmarshalBinary(buff []byte) error { +func (k *G1Elt) UnmarshalBinary(buff []byte) error { var err error k.p, err = bls12381.NewG1().FromCompressed(buff) return err } // MarshalTo writes a compressed point to the Writer, without any domain separation tag information -func (k *KyberG1) MarshalTo(w io.Writer) (int, error) { +func (k *G1Elt) MarshalTo(w io.Writer) (int, error) { buf, err := k.MarshalBinary() if err != nil { return 0, err @@ -138,7 +138,7 @@ func (k *KyberG1) MarshalTo(w io.Writer) (int, error) { } // UnmarshalFrom populates the point from a compressed point representation read from the Reader. -func (k *KyberG1) UnmarshalFrom(r io.Reader) (int, error) { +func (k *G1Elt) UnmarshalFrom(r io.Reader) (int, error) { buf := make([]byte, k.MarshalSize()) n, err := io.ReadFull(r, buf) if err != nil { @@ -147,16 +147,16 @@ func (k *KyberG1) UnmarshalFrom(r io.Reader) (int, error) { return n, k.UnmarshalBinary(buf) } -func (k *KyberG1) MarshalSize() int { +func (k *G1Elt) MarshalSize() int { return 48 } -func (k *KyberG1) String() string { +func (k *G1Elt) String() string { b, _ := k.MarshalBinary() return "bls12-381.G1: " + hex.EncodeToString(b) } -func (k *KyberG1) Hash(m []byte) kyber.Point { +func (k *G1Elt) Hash(m []byte) kyber.Point { domain := domainG1 // We treat a 0 len dst as the default value as per the RFC "Tags MUST have nonzero length" if len(k.dst) != 0 { @@ -167,6 +167,6 @@ func (k *KyberG1) Hash(m []byte) kyber.Point { return k } -func (k *KyberG1) IsInCorrectGroup() bool { +func (k *G1Elt) IsInCorrectGroup() bool { return bls12381.NewG1().InCorrectSubgroup(k.p) } diff --git a/pairing/kilic_bls12381/g2.go b/pairing/kilic_bls12381/g2.go index 93bdc9f6a..cf3db7166 100644 --- a/pairing/kilic_bls12381/g2.go +++ b/pairing/kilic_bls12381/g2.go @@ -19,101 +19,101 @@ func DefaultDomainG2() []byte { return domainG2 } -// KyberG2 is a kyber.Point holding a G2 point on BLS12-381 curve -type KyberG2 struct { +// G2Elt is a kyber.Point holding a G2 point on BLS12-381 curve +type G2Elt struct { p *bls12381.PointG2 // domain separation tag. We treat a 0 len dst as the default value as per the RFC "Tags MUST have nonzero length" dst []byte } -func NullKyberG2(dst ...byte) *KyberG2 { +func NullG2(dst ...byte) *G2Elt { var p bls12381.PointG2 - return newKyberG2(&p, dst) + return newG2(&p, dst) } -func newKyberG2(p *bls12381.PointG2, dst []byte) *KyberG2 { +func newG2(p *bls12381.PointG2, dst []byte) *G2Elt { domain := dst if bytes.Equal(dst, domainG2) { domain = nil } - return &KyberG2{p: p, dst: domain} + return &G2Elt{p: p, dst: domain} } -func (k *KyberG2) Equal(k2 kyber.Point) bool { - k2g2, ok := k2.(*KyberG2) +func (k *G2Elt) Equal(k2 kyber.Point) bool { + k2g2, ok := k2.(*G2Elt) if !ok { return false } return bls12381.NewG2().Equal(k.p, k2g2.p) && bytes.Equal(k.dst, k2g2.dst) } -func (k *KyberG2) Null() kyber.Point { - return newKyberG2(bls12381.NewG2().Zero(), k.dst) +func (k *G2Elt) Null() kyber.Point { + return newG2(bls12381.NewG2().Zero(), k.dst) } -func (k *KyberG2) Base() kyber.Point { - return newKyberG2(bls12381.NewG2().One(), k.dst) +func (k *G2Elt) Base() kyber.Point { + return newG2(bls12381.NewG2().One(), k.dst) } -func (k *KyberG2) Pick(rand cipher.Stream) kyber.Point { +func (k *G2Elt) Pick(rand cipher.Stream) kyber.Point { var dst, src [32]byte rand.XORKeyStream(dst[:], src[:]) return k.Hash(dst[:]) } -func (k *KyberG2) Set(q kyber.Point) kyber.Point { - k.p.Set(q.(*KyberG2).p) +func (k *G2Elt) Set(q kyber.Point) kyber.Point { + k.p.Set(q.(*G2Elt).p) return k } -func (k *KyberG2) Clone() kyber.Point { +func (k *G2Elt) Clone() kyber.Point { var p bls12381.PointG2 p.Set(k.p) - return newKyberG2(&p, k.dst) + return newG2(&p, k.dst) } -func (k *KyberG2) EmbedLen() int { +func (k *G2Elt) EmbedLen() int { panic("bls12-381: unsupported operation") } -func (k *KyberG2) Embed(data []byte, rand cipher.Stream) kyber.Point { +func (k *G2Elt) Embed(data []byte, rand cipher.Stream) kyber.Point { panic("bls12-381: unsupported operation") } -func (k *KyberG2) Data() ([]byte, error) { +func (k *G2Elt) Data() ([]byte, error) { panic("bls12-381: unsupported operation") } -func (k *KyberG2) Add(a, b kyber.Point) kyber.Point { - aa := a.(*KyberG2) - bb := b.(*KyberG2) +func (k *G2Elt) Add(a, b kyber.Point) kyber.Point { + aa := a.(*G2Elt) + bb := b.(*G2Elt) bls12381.NewG2().Add(k.p, aa.p, bb.p) return k } -func (k *KyberG2) Sub(a, b kyber.Point) kyber.Point { - aa := a.(*KyberG2) - bb := b.(*KyberG2) +func (k *G2Elt) Sub(a, b kyber.Point) kyber.Point { + aa := a.(*G2Elt) + bb := b.(*G2Elt) bls12381.NewG2().Sub(k.p, aa.p, bb.p) return k } -func (k *KyberG2) Neg(a kyber.Point) kyber.Point { - aa := a.(*KyberG2) +func (k *G2Elt) Neg(a kyber.Point) kyber.Point { + aa := a.(*G2Elt) bls12381.NewG2().Neg(k.p, aa.p) return k } -func (k *KyberG2) Mul(s kyber.Scalar, q kyber.Point) kyber.Point { +func (k *G2Elt) Mul(s kyber.Scalar, q kyber.Point) kyber.Point { if q == nil { - q = NullKyberG2(k.dst...).Base() + q = NullG2(k.dst...).Base() } - bls12381.NewG2().MulScalarBig(k.p, q.(*KyberG2).p, &s.(*mod.Int).V) + bls12381.NewG2().MulScalarBig(k.p, q.(*G2Elt).p, &s.(*mod.Int).V) return k } // MarshalBinary returns a compressed point, without any domain separation tag information -func (k *KyberG2) MarshalBinary() ([]byte, error) { +func (k *G2Elt) MarshalBinary() ([]byte, error) { // we need to clone the point because of https://github.com/kilic/bls12-381/issues/37 // in order to avoid risks of race conditions. t := new(bls12381.PointG2).Set(k.p) @@ -121,14 +121,14 @@ func (k *KyberG2) MarshalBinary() ([]byte, error) { } // UnmarshalBinary populates the point from a compressed point representation. -func (k *KyberG2) UnmarshalBinary(buff []byte) error { +func (k *G2Elt) UnmarshalBinary(buff []byte) error { var err error k.p, err = bls12381.NewG2().FromCompressed(buff) return err } // MarshalTo writes a compressed point to the Writer, without any domain separation tag information -func (k *KyberG2) MarshalTo(w io.Writer) (int, error) { +func (k *G2Elt) MarshalTo(w io.Writer) (int, error) { buf, err := k.MarshalBinary() if err != nil { return 0, err @@ -137,7 +137,7 @@ func (k *KyberG2) MarshalTo(w io.Writer) (int, error) { } // UnmarshalFrom populates the point from a compressed point representation read from the Reader. -func (k *KyberG2) UnmarshalFrom(r io.Reader) (int, error) { +func (k *G2Elt) UnmarshalFrom(r io.Reader) (int, error) { buf := make([]byte, k.MarshalSize()) n, err := io.ReadFull(r, buf) if err != nil { @@ -146,16 +146,16 @@ func (k *KyberG2) UnmarshalFrom(r io.Reader) (int, error) { return n, k.UnmarshalBinary(buf) } -func (k *KyberG2) MarshalSize() int { +func (k *G2Elt) MarshalSize() int { return 96 } -func (k *KyberG2) String() string { +func (k *G2Elt) String() string { b, _ := k.MarshalBinary() return "bls12-381.G2: " + hex.EncodeToString(b) } -func (k *KyberG2) Hash(m []byte) kyber.Point { +func (k *G2Elt) Hash(m []byte) kyber.Point { domain := domainG2 // We treat a 0 len dst as the default value as per the RFC "Tags MUST have nonzero length" if len(k.dst) != 0 { @@ -166,6 +166,6 @@ func (k *KyberG2) Hash(m []byte) kyber.Point { return k } -func (k *KyberG2) IsInCorrectGroup() bool { +func (k *G2Elt) IsInCorrectGroup() bool { return bls12381.NewG2().InCorrectSubgroup(k.p) } diff --git a/pairing/kilic_bls12381/group.go b/pairing/kilic_bls12381/group.go index c51cfc452..7d36d4b81 100644 --- a/pairing/kilic_bls12381/group.go +++ b/pairing/kilic_bls12381/group.go @@ -30,7 +30,7 @@ func (g *groupBls) String() string { } func (g *groupBls) Scalar() kyber.Scalar { - return NewKyberScalar() + return NewScalar() } func (g *groupBls) ScalarLen() int { @@ -67,7 +67,7 @@ func (g *groupBls) RandomStream() cipher.Stream { func NewGroupG1(dst ...byte) kyber.Group { return &groupBls{ str: "bls12-381.G1", - newPoint: func() kyber.Point { return NullKyberG1(dst...) }, + newPoint: func() kyber.Point { return NullG1(dst...) }, isPrime: true, } } @@ -75,7 +75,7 @@ func NewGroupG1(dst ...byte) kyber.Group { func NewGroupG2(dst ...byte) kyber.Group { return &groupBls{ str: "bls12-381.G2", - newPoint: func() kyber.Point { return NullKyberG2(dst...) }, + newPoint: func() kyber.Point { return NullG2(dst...) }, isPrime: false, } } diff --git a/pairing/kilic_bls12381/gt.go b/pairing/kilic_bls12381/gt.go index 8ead9eddb..5aee5a5a2 100644 --- a/pairing/kilic_bls12381/gt.go +++ b/pairing/kilic_bls12381/gt.go @@ -10,79 +10,79 @@ import ( "go.dedis.ch/kyber/v3/group/mod" ) -type KyberGT struct { +type GTElt struct { f *bls12381.E } -func newEmptyGT() *KyberGT { - return newKyberGT(bls12381.NewGT().New()) +func newEmptyGT() *GTElt { + return newGT(bls12381.NewGT().New()) } -func newKyberGT(f *bls12381.E) *KyberGT { - return &KyberGT{ +func newGT(f *bls12381.E) *GTElt { + return >Elt{ f: f, } } -func (k *KyberGT) Equal(kk kyber.Point) bool { - return k.f.Equal(kk.(*KyberGT).f) +func (k *GTElt) Equal(kk kyber.Point) bool { + return k.f.Equal(kk.(*GTElt).f) } -func (k *KyberGT) Null() kyber.Point { +func (k *GTElt) Null() kyber.Point { // One since we deal with Gt elements as a multiplicative group only // i.e. Add in kyber -> mul in kilic/, Neg in kyber -> inverse in kilic/ etc k.f = bls12381.NewGT().New() return k } -func (k *KyberGT) Base() kyber.Point { +func (k *GTElt) Base() kyber.Point { panic("bls12-381.GT.Base(): unsupported operation") } -func (k *KyberGT) Pick(rand cipher.Stream) kyber.Point { +func (k *GTElt) Pick(rand cipher.Stream) kyber.Point { panic("bls12-381.GT.Pick(): unsupported operation") } -func (k *KyberGT) Set(q kyber.Point) kyber.Point { - k.f.Set(q.(*KyberGT).f) +func (k *GTElt) Set(q kyber.Point) kyber.Point { + k.f.Set(q.(*GTElt).f) return k } -func (k *KyberGT) Clone() kyber.Point { +func (k *GTElt) Clone() kyber.Point { kk := newEmptyGT() kk.Set(k) return kk } -func (k *KyberGT) Add(a, b kyber.Point) kyber.Point { - aa := a.(*KyberGT) - bb := b.(*KyberGT) +func (k *GTElt) Add(a, b kyber.Point) kyber.Point { + aa := a.(*GTElt) + bb := b.(*GTElt) bls12381.NewGT().Mul(k.f, aa.f, bb.f) return k } -func (k *KyberGT) Sub(a, b kyber.Point) kyber.Point { +func (k *GTElt) Sub(a, b kyber.Point) kyber.Point { nb := newEmptyGT().Neg(b) return newEmptyGT().Add(a, nb) } -func (k *KyberGT) Neg(q kyber.Point) kyber.Point { - qq := q.(*KyberGT) +func (k *GTElt) Neg(q kyber.Point) kyber.Point { + qq := q.(*GTElt) bls12381.NewGT().Inverse(k.f, qq.f) return k } -func (k *KyberGT) Mul(s kyber.Scalar, q kyber.Point) kyber.Point { +func (k *GTElt) Mul(s kyber.Scalar, q kyber.Point) kyber.Point { v := s.(*mod.Int).V - qq := q.(*KyberGT) + qq := q.(*GTElt) bls12381.NewGT().Exp(k.f, qq.f, &v) return k } -func (k *KyberGT) MarshalBinary() ([]byte, error) { +func (k *GTElt) MarshalBinary() ([]byte, error) { return bls12381.NewGT().ToBytes(k.f), nil } -func (k *KyberGT) MarshalTo(w io.Writer) (int, error) { +func (k *GTElt) MarshalTo(w io.Writer) (int, error) { buf, err := k.MarshalBinary() if err != nil { return 0, err @@ -90,13 +90,13 @@ func (k *KyberGT) MarshalTo(w io.Writer) (int, error) { return w.Write(buf) } -func (k *KyberGT) UnmarshalBinary(buf []byte) error { +func (k *GTElt) UnmarshalBinary(buf []byte) error { fe12, err := bls12381.NewGT().FromBytes(buf) k.f = fe12 return err } -func (k *KyberGT) UnmarshalFrom(r io.Reader) (int, error) { +func (k *GTElt) UnmarshalFrom(r io.Reader) (int, error) { buf := make([]byte, k.MarshalSize()) n, err := io.ReadFull(r, buf) if err != nil { @@ -105,23 +105,23 @@ func (k *KyberGT) UnmarshalFrom(r io.Reader) (int, error) { return n, k.UnmarshalBinary(buf) } -func (k *KyberGT) MarshalSize() int { +func (k *GTElt) MarshalSize() int { return 576 } -func (k *KyberGT) String() string { +func (k *GTElt) String() string { b, _ := k.MarshalBinary() return "bls12-381.GT: " + hex.EncodeToString(b) } -func (k *KyberGT) EmbedLen() int { +func (k *GTElt) EmbedLen() int { panic("bls12-381.GT.EmbedLen(): unsupported operation") } -func (k *KyberGT) Embed(data []byte, rand cipher.Stream) kyber.Point { +func (k *GTElt) Embed(data []byte, rand cipher.Stream) kyber.Point { panic("bls12-381.GT.Embed(): unsupported operation") } -func (k *KyberGT) Data() ([]byte, error) { +func (k *GTElt) Data() ([]byte, error) { panic("bls12-381.GT.Data(): unsupported operation") } diff --git a/pairing/kilic_bls12381/scalar.go b/pairing/kilic_bls12381/scalar.go index 36c3e7a30..7c691f895 100644 --- a/pairing/kilic_bls12381/scalar.go +++ b/pairing/kilic_bls12381/scalar.go @@ -9,6 +9,6 @@ import ( var curveOrder, _ = new(big.Int).SetString("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16) -func NewKyberScalar() kyber.Scalar { +func NewScalar() kyber.Scalar { return mod.NewInt64(0, curveOrder) } diff --git a/pairing/kilic_bls12381/suite.go b/pairing/kilic_bls12381/suite.go index ed890dd0b..98ba17ac1 100644 --- a/pairing/kilic_bls12381/suite.go +++ b/pairing/kilic_bls12381/suite.go @@ -56,10 +56,10 @@ func (s *Suite) ValidatePairing(p1, p2, p3, p4 kyber.Point) bool { e := bls12381.NewEngine() // we need to clone the point because of https://github.com/kilic/bls12-381/issues/37 // in order to avoid risks of race conditions. - g1point := new(bls12381.PointG1).Set(p1.(*KyberG1).p) - g2point := new(bls12381.PointG2).Set(p2.(*KyberG2).p) - g1point2 := new(bls12381.PointG1).Set(p3.(*KyberG1).p) - g2point2 := new(bls12381.PointG2).Set(p4.(*KyberG2).p) + g1point := new(bls12381.PointG1).Set(p1.(*G1Elt).p) + g2point := new(bls12381.PointG2).Set(p2.(*G2Elt).p) + g1point2 := new(bls12381.PointG1).Set(p3.(*G1Elt).p) + g2point2 := new(bls12381.PointG2).Set(p4.(*G2Elt).p) e.AddPair(g1point, g2point) e.AddPairInv(g1point2, g2point2) return e.Check() @@ -67,9 +67,9 @@ func (s *Suite) ValidatePairing(p1, p2, p3, p4 kyber.Point) bool { func (s *Suite) Pair(p1, p2 kyber.Point) kyber.Point { e := bls12381.NewEngine() - g1point := p1.(*KyberG1).p - g2point := p2.(*KyberG2).p - return newKyberGT(e.AddPair(g1point, g2point).Result()) + g1point := p1.(*G1Elt).p + g2point := p2.(*G2Elt).p + return newGT(e.AddPair(g1point, g2point).Result()) } // New implements the kyber.Encoding interface. diff --git a/pairing/kilic_bls12381/suite_test.go b/pairing/kilic_bls12381/suite_test.go index 2e86ffc5d..7d5f2a172 100644 --- a/pairing/kilic_bls12381/suite_test.go +++ b/pairing/kilic_bls12381/suite_test.go @@ -498,11 +498,11 @@ func TestVerifySigOnG2(t *testing.T) { } func TestImplementInterfaces(t *testing.T) { - var _ kyber.Point = &KyberG1{} - var _ kyber.Point = &KyberG2{} - var _ kyber.Point = &KyberGT{} - var _ kyber.HashablePoint = &KyberG1{} - var _ kyber.HashablePoint = &KyberG2{} + var _ kyber.Point = &G1Elt{} + var _ kyber.Point = &G2Elt{} + var _ kyber.Point = >Elt{} + var _ kyber.HashablePoint = &G1Elt{} + var _ kyber.HashablePoint = &G2Elt{} // var _ kyber.hashablePoint = &KyberGT{} // GT is not hashable for now var _ kyber.Group = &groupBls{} var _ pairing.Suite = &Suite{} @@ -533,10 +533,10 @@ func TestSuiteWithDST(t *testing.T) { } func TestExplicitDefaultDST(t *testing.T) { - g1d1 := NullKyberG1([]byte("BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_")...) - g2d1 := NullKyberG2([]byte("BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_")...) - g1d2 := NullKyberG1([]byte("BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_")...) - g2d2 := NullKyberG2([]byte("BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_")...) + g1d1 := NullG1([]byte("BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_")...) + g2d1 := NullG2([]byte("BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_")...) + g1d2 := NullG1([]byte("BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_")...) + g2d2 := NullG2([]byte("BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_")...) if g1d1.dst != nil { t.Fatal("Default G1 DST should be represented internally as nil. Got:", string(g1d1.dst)) @@ -554,10 +554,10 @@ func TestExplicitDefaultDST(t *testing.T) { suite := NewBLS12381SuiteWithDST(DefaultDomainG2(), DefaultDomainG2()) sg1 := suite.G1().Point() sg2 := suite.G2().Point() - if p, ok := sg1.(*KyberG1); !ok || !bytes.Equal(p.dst, domainG2) { + if p, ok := sg1.(*G1Elt); !ok || !bytes.Equal(p.dst, domainG2) { t.Fatal("Non-default G1 DST should not be nil. Got:", string(p.dst)) } - if p, ok := sg2.(*KyberG2); !ok || p.dst != nil { + if p, ok := sg2.(*G2Elt); !ok || p.dst != nil { t.Fatal("Default G2 DST should be represented internally as nil. Got:", string(p.dst)) } }