Exemplo n.º 1
0
func (e *G1) String() string {
	C.g1_make_affine(&e.p)
	c := newConvertContext()
	x := c.doublesToInt(new(big.Int), C.g1_x(&e.p))
	y := c.doublesToInt(new(big.Int), C.g1_y(&e.p))
	return "bn256.G1(" + x.String() + ", " + y.String() + ")"
}
Exemplo n.º 2
0
func (e *G1) Marshal() []byte {
	out := make([]byte, numBytes*2)
	C.g1_make_affine(&e.p)

	c := newConvertContext()
	c.doublesToBytes(out, C.g1_x(&e.p))
	c.doublesToBytes(out[numBytes:], C.g1_y(&e.p))

	return out
}