Documentation
¶
Index ¶
- func ImplicitSig(sPriv, ePriv, t []byte) ([]byte, error)
- func Marshal(curve elliptic.Curve, x, y *big.Int) []byte
- func MarshalCompressed(curve elliptic.Curve, x, y *big.Int) []byte
- func P256() elliptic.Curve
- func P256OrdInverse(k []byte) ([]byte, error)
- func P256OrdMul(in1, in2 []byte) ([]byte, error)
- func Unmarshal(curve elliptic.Curve, data []byte) (x, y *big.Int)
- func UnmarshalCompressed(curve elliptic.Curve, data []byte) (x, y *big.Int)
- type Point
- func (q *Point) Add(p1, p2 *Point) *Point
- func (p *Point) Bytes() []byte
- func (p *Point) BytesCompressed() []byte
- func (p *Point) BytesX() ([]byte, error)
- func (q *Point) Double(p *Point) *Point
- func (p *Point) ScalarBaseMult(scalar []byte) (*Point, error)
- func (p *Point) ScalarMult(q *Point, scalar []byte) (*Point, error)
- func (q *Point) Select(p1, p2 *Point, cond int) *Point
- func (p *Point) Set(q *Point) *Point
- func (p *Point) SetBytes(b []byte) (*Point, error)
- func (p *Point) SetGenerator() *Point
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImplicitSig ¶
func MarshalCompressed ¶
MarshalCompressed converts a point on the curve into the compressed form specified in SEC 1, Version 2.0, Section 2.3.3. If the point is not on the curve (or is the conventional point at infinity), the behavior is undefined.
func P256OrdInverse ¶
P256OrdInverse, sets out to in⁻¹ mod org(G). If in is zero, out will be zero. n-2 = 1111111111111111111111111111111011111111111111111111111111111111 1111111111111111111111111111111111111111111111111111111111111111 0111001000000011110111110110101100100001110001100000010100101011 0101001110111011111101000000100100111001110101010100000100100001
func P256OrdMul ¶
P256OrdMul multiplication modulo org(G).
func Unmarshal ¶
Unmarshal converts a point, serialized by Marshal, into an x, y pair. It is an error if the point is not in uncompressed form, is not on the curve, or is the point at infinity. On error, x = nil.
func UnmarshalCompressed ¶
UnmarshalCompressed converts a point, serialized by MarshalCompressed, into an x, y pair. It is an error if the point is not in compressed form, is not on the curve, or is the point at infinity. On error, x = nil.
Types ¶
type Point ¶
type Point struct {
// contains filtered or unexported fields
}
Point is a SM2P256 point. The zero value is NOT valid.
func NewPoint ¶
func NewPoint() *Point
NewPoint returns a new Point representing the point at infinity point.
func (*Point) Bytes ¶
Bytes returns the uncompressed or infinity encoding of p, as specified in SEC 1, Version 2.0, Section 2.3.3. Note that the encoding of the point at infinity is shorter than all other encodings.
func (*Point) BytesCompressed ¶
BytesCompressed returns the compressed or infinity encoding of p, as specified in SEC 1, Version 2.0, Section 2.3.3. Note that the encoding of the point at infinity is shorter than all other encodings.
func (*Point) BytesX ¶
BytesX returns the encoding of the x-coordinate of p, as specified in SEC 1, Version 2.0, Section 2.3.5, or an error if p is the point at infinity.
func (*Point) ScalarBaseMult ¶
ScalarBaseMult sets p = scalar * B, where B is the canonical generator, and returns p.
func (*Point) ScalarMult ¶
ScalarMult sets p = scalar * q, and returns p.
func (*Point) SetBytes ¶
SetBytes sets p to the compressed, uncompressed, or infinity value encoded in b, as specified in SEC 1, Version 2.0, Section 2.3.4. If the point is not on the curve, it returns nil and an error, and the receiver is unchanged. Otherwise, it returns p.
func (*Point) SetGenerator ¶
SetGenerator sets p to the canonical generator and returns p.