github.com/lzy4123/fabric@v2.1.1+incompatible/bccsp/idemix/bridge/math.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 package bridge 7 8 import ( 9 "github.com/hyperledger/fabric-amcl/amcl/FP256BN" 10 "github.com/hyperledger/fabric/idemix" 11 ) 12 13 // Big encapsulate an amcl big integer 14 type Big struct { 15 E *FP256BN.BIG 16 } 17 18 func (b *Big) Bytes() ([]byte, error) { 19 return idemix.BigToBytes(b.E), nil 20 } 21 22 // Ecp encapsulate an amcl elliptic curve point 23 type Ecp struct { 24 E *FP256BN.ECP 25 } 26 27 func (o *Ecp) Bytes() ([]byte, error) { 28 var res []byte 29 res = append(res, idemix.BigToBytes(o.E.GetX())...) 30 res = append(res, idemix.BigToBytes(o.E.GetY())...) 31 32 return res, nil 33 }