Marshal converts a point into the form specified in section 4.3.6 of ANSI X9.62.
(x, y *big.Int)
| 284 | // Marshal converts a point into the form specified in section 4.3.6 of ANSI |
| 285 | // X9.62. |
| 286 | func (BitCurve *BitCurve) Marshal(x, y *big.Int) []byte { |
| 287 | byteLen := (BitCurve.BitSize + 7) >> 3 |
| 288 | ret := make([]byte, 1+2*byteLen) |
| 289 | ret[0] = 4 // uncompressed point flag |
| 290 | readBits(x, ret[1:1+byteLen]) |
| 291 | readBits(y, ret[1+byteLen:]) |
| 292 | return ret |
| 293 | } |
| 294 | |
| 295 | // Unmarshal converts a point, serialised by Marshal, into an x, y pair. On |
| 296 | // error, x = nil. |