crypto

package
v0.0.0-...-ebb7192 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Sm2KeySize = 32

ref:《SM2椭圆曲线公钥密码算法推荐曲线参数》http://www.oscca.gov.cn/UpFile/2010122214836668.pdf Curve-SM2-P-256: len(P) = 64; len(N) = 64; len(B) = 64; len(Gx) = 32; len(Gy) = 32; so SM2_KEY_SIZE == 32 bytes

Variables

This section is empty.

Functions

func Base58Decode

func Base58Decode(src []byte) (*big.Int, error)

Decode a big integer from the bytes. Returns an error on corrupt input.

func Base58Encode

func Base58Encode(dst []byte, src *big.Int) []byte

Encode encodes src, appending to dst. Be sure to use the returned new value of dst.

func SM3Hash

func SM3Hash(msg string) string

SM3Hash can generate the SM3 checksum for string.

func SM3HashByte

func SM3HashByte(msg []byte) []byte

like SM3Hash but use byte array.

func VerifySign

func VerifySign(pubKey, sign, hash []byte) bool

Signature Verify

Types

type CorruptInputError

type CorruptInputError int64

func (CorruptInputError) Error

func (e CorruptInputError) Error() string

type Keypair

type Keypair struct {
	PublicKey  []byte
	PrivateKey []byte
}

A set of security credentials you use to prove your identity electronically.

func GenerateKeypair

func GenerateKeypair() *Keypair

Generate New Keypair

func (*Keypair) Sign

func (k *Keypair) Sign(hash []byte) ([]byte, error)

Sign Message by PrivateKey

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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