Example #1
0
func (p *point) Data() ([]byte, error) {
	var b [32]byte
	C.ge_p3_tobytes((*C.uchar)(unsafe.Pointer(&b[0])), &p.p)
	dl := int(b[0]) // extract length byte
	if dl > p.PickLen() {
		return nil, errors.New("invalid embedded data length")
	}
	return b[1 : 1+dl], nil
}
Example #2
0
func (p *point) MarshalBinary() ([]byte, error) {
	buf := [32]byte{}
	C.ge_p3_tobytes((*C.uchar)(unsafe.Pointer(&buf[0])), &p.p)
	return buf[:], nil
}