curves

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Secp256k1 string = "secp256k1"
	Ed25519   string = "ed25519"
)

Variables

This section is empty.

Functions

func GetCurveByName

func GetCurveByName(curveName string) (elliptic.Curve, bool)

func GetCurveName

func GetCurveName(curve elliptic.Curve) string

Types

type ECPoint

type ECPoint struct {
	Curve elliptic.Curve
	X     *big.Int
	Y     *big.Int
}

func EcdsaPubKeyToPoint

func EcdsaPubKeyToPoint(pubkeyStr string) (*ECPoint, error)

func Ed25519PubKeyToPoint

func Ed25519PubKeyToPoint(pubkeyStr string) (*ECPoint, error)

func NewECPoint

func NewECPoint(curve elliptic.Curve, X, Y *big.Int) (*ECPoint, error)

func ScalarToPoint

func ScalarToPoint(curve elliptic.Curve, k *big.Int) *ECPoint

ScalarToPoint return public key k*G

func (*ECPoint) Add

func (p *ECPoint) Add(p1 *ECPoint) (*ECPoint, error)

Add two point add

func (*ECPoint) Equals

func (p *ECPoint) Equals(p2 *ECPoint) bool

func (*ECPoint) IsOnCurve

func (p *ECPoint) IsOnCurve() bool

func (*ECPoint) MarshalJSON

func (p *ECPoint) MarshalJSON() ([]byte, error)

func (*ECPoint) PointToEcdsaPubKey

func (p *ECPoint) PointToEcdsaPubKey() string

func (*ECPoint) PointToEd25519PubKey

func (p *ECPoint) PointToEd25519PubKey() string

func (*ECPoint) ScalarMult

func (p *ECPoint) ScalarMult(k *big.Int) *ECPoint

func (*ECPoint) SetCurve

func (p *ECPoint) SetCurve(curve elliptic.Curve) *ECPoint

func (*ECPoint) UnmarshalJSON

func (p *ECPoint) UnmarshalJSON(payload []byte) error

Jump to

Keyboard shortcuts

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