Documentation ¶
Overview ¶
Package secp256k1 secp256k1系统加密包
Index ¶
- Constants
- type Driver
- func (d Driver) GenKey() (crypto.PrivKey, error)
- func (d Driver) PrivKeyFromBytes(b []byte) (privKey crypto.PrivKey, err error)
- func (d Driver) PubKeyFromBytes(b []byte) (pubKey crypto.PubKey, err error)
- func (d Driver) SignatureFromBytes(b []byte) (sig crypto.Signature, err error)
- func (d Driver) Validate(msg, pub, sig []byte) error
- type PrivKeySecp256k1
- type PubKeySecp256k1
- type SignatureS
- type SignatureSecp256k1
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) PrivKeyFromBytes ¶
PrivKeyFromBytes 字节转为私钥
func (Driver) PubKeyFromBytes ¶
PubKeyFromBytes 字节转为公钥
func (Driver) SignatureFromBytes ¶
SignatureFromBytes 字节转为签名
type PrivKeySecp256k1 ¶
type PrivKeySecp256k1 [32]byte
PrivKeySecp256k1 PrivKey
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) 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 SignatureSecp256k1 ¶
type SignatureSecp256k1 []byte
SignatureSecp256k1 Signature
func (SignatureSecp256k1) Equals ¶
func (sig SignatureSecp256k1) Equals(other crypto.Signature) bool
Equals 相等
func (SignatureSecp256k1) String ¶
func (sig SignatureSecp256k1) String() string
Click to show internal directories.
Click to hide internal directories.