func (e *G2) String() string { C.g2_make_affine(&e.p) c := newConvertContext() xa := c.doublesFP2ToInt(new(big.Int), C.g2_x(&e.p), 1) xb := c.doublesFP2ToInt(new(big.Int), C.g2_x(&e.p), 0) ya := c.doublesFP2ToInt(new(big.Int), C.g2_y(&e.p), 1) yb := c.doublesFP2ToInt(new(big.Int), C.g2_y(&e.p), 0) return "bn256.G2((" + xa.String() + ", " + xb.String() + "), (" + ya.String() + ", " + yb.String() + "))" }
func (e *G2) ScalarMult(base *G2, k *big.Int) *G2 { words, bitLen := powerToWords(k) if bitLen == 0 { C.g2_set(&e.p, &base.p) } else { C.g2_make_affine(&base.p) C.g2_scalar_mult(&e.p, &base.p, (*C.ulonglong)(unsafe.Pointer(&words[0])), C.unsigned(bitLen)) } return e }
func (e *G2) Marshal() []byte { out := make([]byte, numBytes*4) C.g2_make_affine(&e.p) c := newConvertContext() c.doublesFP2ToBytes(out, C.g2_x(&e.p)) c.doublesFP2ToBytes(out[2*numBytes:], C.g2_y(&e.p)) return out }