ReadFrom attempts to read 32 bytes and decode a point.
(r io.Reader)
| 47 | |
| 48 | // ReadFrom attempts to read 32 bytes and decode a point. |
| 49 | func (p *Point) ReadFrom(r io.Reader) (n int64, err error) { |
| 50 | var buf [32]byte |
| 51 | m, err := io.ReadFull(r, buf[:]) |
| 52 | if err != nil { |
| 53 | return |
| 54 | } |
| 55 | if !(*edwards25519.ExtendedGroupElement)(p).FromBytes(&buf) { |
| 56 | err = fmt.Errorf("invalid ecmath.Point encoding") |
| 57 | } |
| 58 | return int64(m), err |
| 59 | } |
| 60 | |
| 61 | // MarshalText returns a hex-encoded point. |
| 62 | func (p *Point) MarshalText() ([]byte, error) { |