secp256k1

package
v1.69.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: BSD-3-Clause Imports: 5 Imported by: 19

Documentation

Overview

Package secp256k1 secp256k1系统加密包

Index

Constants

View Source
const (
	Name = "secp256k1"
	ID   = 1
)

const

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver struct{}

Driver 驱动

func (Driver) GenKey

func (d Driver) GenKey() (crypto.PrivKey, error)

GenKey 生成私钥

func (Driver) PrivKeyFromBytes

func (d Driver) PrivKeyFromBytes(b []byte) (privKey crypto.PrivKey, err error)

PrivKeyFromBytes 字节转为私钥

func (Driver) PubKeyFromBytes

func (d Driver) PubKeyFromBytes(b []byte) (pubKey crypto.PubKey, err error)

PubKeyFromBytes 字节转为公钥

func (Driver) SignatureFromBytes

func (d Driver) SignatureFromBytes(b []byte) (sig crypto.Signature, err error)

SignatureFromBytes 字节转为签名

func (Driver) Validate added in v1.65.1

func (d Driver) Validate(msg, pub, sig []byte) error

Validate validate msg and signature

type PrivKeySecp256k1

type PrivKeySecp256k1 [32]byte

PrivKeySecp256k1 PrivKey

func (PrivKeySecp256k1) Bytes

func (privKey PrivKeySecp256k1) Bytes() []byte

Bytes 字节格式

func (PrivKeySecp256k1) Equals

func (privKey PrivKeySecp256k1) Equals(other crypto.PrivKey) bool

Equals 私钥是否相等

func (PrivKeySecp256k1) PubKey

func (privKey PrivKeySecp256k1) PubKey() crypto.PubKey

PubKey 私钥生成公钥

func (PrivKeySecp256k1) Sign

func (privKey PrivKeySecp256k1) Sign(msg []byte) crypto.Signature

Sign 签名

func (PrivKeySecp256k1) String

func (privKey PrivKeySecp256k1) String() string

type PubKeySecp256k1

type PubKeySecp256k1 [33]byte

PubKeySecp256k1 Compressed pubkey (just the x-cord), prefixed with 0x02 or 0x03, depending on the y-cord.

func (PubKeySecp256k1) Bytes

func (pubKey PubKeySecp256k1) Bytes() []byte

Bytes 字节格式

func (PubKeySecp256k1) Equals

func (pubKey PubKeySecp256k1) Equals(other crypto.PubKey) bool

Equals 公钥相等

func (PubKeySecp256k1) KeyString

func (pubKey PubKeySecp256k1) KeyString() string

KeyString Must return the full bytes in hex. Used for map keying, etc.

func (PubKeySecp256k1) String

func (pubKey PubKeySecp256k1) String() string

func (PubKeySecp256k1) VerifyBytes

func (pubKey PubKeySecp256k1) VerifyBytes(msg []byte, sig crypto.Signature) bool

VerifyBytes 验证字节

type SignatureS

type SignatureS struct {
	crypto.Signature
}

SignatureS 签名

type SignatureSecp256k1

type SignatureSecp256k1 []byte

SignatureSecp256k1 Signature

func (SignatureSecp256k1) Bytes

func (sig SignatureSecp256k1) Bytes() []byte

Bytes 字节格式

func (SignatureSecp256k1) Equals

func (sig SignatureSecp256k1) Equals(other crypto.Signature) bool

Equals 相等

func (SignatureSecp256k1) IsZero

func (sig SignatureSecp256k1) IsZero() bool

IsZero 是否是0

func (SignatureSecp256k1) String

func (sig SignatureSecp256k1) String() string

Jump to

Keyboard shortcuts

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