Skip to content

Commit

Permalink
implement Stringer interface for bn254 groups
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincharm committed Feb 16, 2024
1 parent 87b28bb commit 2204457
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pairing/bn254/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bn254

import (
"crypto/cipher"
"encoding/hex"

"github.com/drand/kyber"
"github.com/drand/kyber/group/mod"
Expand All @@ -14,7 +15,8 @@ type groupG1 struct {
}

func (g *groupG1) String() string {
return "bn254.G1"
b, _ := g.Point().MarshalBinary()
return "bn254.G1: " + hex.EncodeToString(b)
}

func (g *groupG1) PointLen() int {
Expand All @@ -32,7 +34,8 @@ type groupG2 struct {
}

func (g *groupG2) String() string {
return "bn254.G2"
b, _ := g.Point().MarshalBinary()
return "bn254.G2: " + hex.EncodeToString(b)
}

func (g *groupG2) PointLen() int {
Expand All @@ -49,7 +52,8 @@ type groupGT struct {
}

func (g *groupGT) String() string {
return "bn254.GT"
b, _ := g.Point().MarshalBinary()
return "bn254.GT: " + hex.EncodeToString(b)
}

func (g *groupGT) PointLen() int {
Expand Down

0 comments on commit 2204457

Please sign in to comment.