MCPcopy Create free account
hub / github.com/chain/txvm / UnmarshalText

Method UnmarshalText

crypto/ed25519/ecmath/point_serialization.go:70–83  ·  view source on GitHub ↗

UnmarshalText decodes a point from a hex-encoded buffer.

(b []byte)

Source from the content-addressed store, hash-verified

68
69// UnmarshalText decodes a point from a hex-encoded buffer.
70func (p *Point) UnmarshalText(b []byte) error {
71 var buf [32]byte
72 if len(b) != hex.EncodedLen(len(buf)) {
73 return fmt.Errorf("ecmath.Point.UnmarshalText got input with wrong length %d", len(b))
74 }
75 _, err := hex.Decode(buf[:], b)
76 if err != nil {
77 return err
78 }
79 if !(*edwards25519.ExtendedGroupElement)(p).FromBytes(&buf) {
80 return fmt.Errorf("invalid ecmath.Point encoding")
81 }
82 return nil
83}

Callers

nothing calls this directly

Calls 2

DecodeMethod · 0.80
FromBytesMethod · 0.45

Tested by

no test coverage detected