Skip to content

Commit

Permalink
Merge pull request #9 from cloudflare/testMarshal
Browse files Browse the repository at this point in the history
Adds identities on marshaling function for G1,G2,GT.
  • Loading branch information
Brendan McMillion committed May 23, 2019
2 parents 0ee3663 + 0a352d7 commit 828ba4f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bn256.go
Expand Up @@ -105,6 +105,10 @@ func (e *G1) Marshal() []byte {
// Each value is a 256-bit number.
const numBytes = 256 / 8

if e.p == nil {
e.p = &curvePoint{}
}

e.p.MakeAffine()
ret := make([]byte, numBytes*2)
if e.p.IsInfinity() {
Expand Down Expand Up @@ -391,6 +395,11 @@ func (e *GT) Marshal() []byte {
// Each value is a 256-bit number.
const numBytes = 256 / 8

if e.p == nil {
e.p = &gfP12{}
e.p.SetOne()
}

ret := make([]byte, numBytes*12)
temp := &gfP{}

Expand Down

0 comments on commit 828ba4f

Please sign in to comment.