ecc

package
v0.0.0-...-aafbcf9 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ECPoint

type ECPoint struct {
	CurveName string
	X, Y      *big.Int
}

type Point

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

Point 定义椭圆曲线上的点

func HashToCurve

func HashToCurve(msg []byte, curve elliptic.Curve) (*Point, error)

The P-384 curve is defined over the prime field GF(p), where p is: p = 2^384 - 2^128 - 2^96 + 2^32 - 1

func NewPoint

func NewPoint(curve elliptic.Curve, x, y *big.Int) (*Point, error)

NewPoint 根据坐标和曲线类型构造Point

func NewPointFromString

func NewPointFromString(pointStr string) (*Point, error)

func ScalarBaseMult

func ScalarBaseMult(curve elliptic.Curve, k *big.Int) *Point

func (*Point) Add

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

Add 计算两个点的加法

func (*Point) Equals

func (p *Point) Equals(p1 *Point) bool

Equals 判断两个点是否相同

func (*Point) ScalarMult

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

ScalarMult 计算一个点的数乘

func (*Point) ToString

func (p *Point) ToString() (string, error)

ToString 将Point转换为string类型

Jump to

Keyboard shortcuts

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