From 2204457b969da83c4400782af2a6b79ee4687132 Mon Sep 17 00:00:00 2001 From: Kevin Charm Date: Fri, 16 Feb 2024 19:21:35 +0100 Subject: [PATCH] implement Stringer interface for bn254 groups --- pairing/bn254/group.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pairing/bn254/group.go b/pairing/bn254/group.go index c1dc41ae8..85ea79b69 100644 --- a/pairing/bn254/group.go +++ b/pairing/bn254/group.go @@ -2,6 +2,7 @@ package bn254 import ( "crypto/cipher" + "encoding/hex" "github.com/drand/kyber" "github.com/drand/kyber/group/mod" @@ -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 { @@ -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 { @@ -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 {