sm9

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2022 License: ISC Imports: 4 Imported by: 2

README

SM9

ISC License GoDoc Go Report Card

GM/T 0044-2016 SM9 Public key algorithm 256-bit

Parameters for the sm9p256v1 Elliptic curve

SM9 is a Chinese National Identity Based Cryptography Standard and was originally published using a 256-bit Barreto-Naehrig Curve as its primary example. The new paper suggests that because attacks against some Barreto-Naehrig curves have improved that the SM9 standard should adopt a 384-bit Barreto-Naehrig Curve. The authors go on to suggest that this curve offers roughly 118 bits of security.

License

This project is licensed under the ISC License.

Documentation

Overview

Parameters for the SM9 (sm9p256v1) Elliptic curve

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressPoint

func CompressPoint(curve *Curve, X, Y *big.Int) (cp []byte)

func LegendreSymbol

func LegendreSymbol(a, p *big.Int) int

func P256

func P256() elliptic.Curve

Types

type Curve

type Curve struct {
	P       *big.Int // the order of the underlying field
	N       *big.Int // the order of the base point
	B       *big.Int // the constant of the Curve equation
	Gx, Gy  *big.Int // (x,y) of the base point
	BitSize int      // the size of the underlying field
}

func (*Curve) Add

func (curve *Curve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int)

func (*Curve) CompressPoint

func (curve *Curve) CompressPoint(X, Y *big.Int) (cp []byte)

func (*Curve) DecompressPoint

func (curve *Curve) DecompressPoint(cp []byte) (X, Y *big.Int, err error)

func (*Curve) Double

func (curve *Curve) Double(x1, y1 *big.Int) (*big.Int, *big.Int)

func (*Curve) IsOnCurve

func (curve *Curve) IsOnCurve(x, y *big.Int) bool

func (*Curve) Params

func (curve *Curve) Params() *elliptic.CurveParams

func (*Curve) ScalarBaseMult

func (curve *Curve) ScalarBaseMult(k []byte) (*big.Int, *big.Int)

func (*Curve) ScalarMult

func (curve *Curve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int)

func (*Curve) Sqrt

func (curve *Curve) Sqrt(a *big.Int) *big.Int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL