crypto

package
v0.0.0-...-aed2fb2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CRC32Data

func CRC32Data(data []byte) uint32

对字节数组进行CRC加密并返回其结果。

func CRC32String

func CRC32String(str string) uint32

对字符串进行CRC加密并返回其结果。

func DecodedBase64

func DecodedBase64(data string) ([]byte, error)

对数据进行Base64解码

func EncryptBase64

func EncryptBase64(data []byte) string

对数据进行Base64编码

func MD5Data

func MD5Data(data []byte) string

对字节数组进行MD5加密并返回其结果。

func MD5String

func MD5String(str string) string

对字符串进行MD5加密并返回其结果。

func SHA1Data

func SHA1Data(data []byte) string

对字节数组进行SHA1加密并返回其结果。

func SHA1String

func SHA1String(str string) string

对字符串进行SHA1加密并返回其结果。

func SHA256Data

func SHA256Data(data []byte) string

对字节数组进行SHA256加密并返回其结果。

func SHA256String

func SHA256String(str string) string

对字符串进行SHA256加密并返回其结果。

Types

type Rsa

type Rsa struct {
	PrivateKey []byte // 私钥
	// contains filtered or unexported fields
}

RSA助手数据结构

func (*Rsa) GenRsaKey

func (slf *Rsa) GenRsaKey(keyLength int) error

发布一对新的密钥,原有密钥失效

func (*Rsa) GetPrivateKey

func (slf *Rsa) GetPrivateKey() []byte

获取私钥

func (*Rsa) GetPublicKey

func (slf *Rsa) GetPublicKey() []byte

获取公钥

func (*Rsa) RsaDecrypt

func (slf *Rsa) RsaDecrypt(ciphertext []byte) ([]byte, error)

Rsa解密

func (*Rsa) RsaEncrypt

func (slf *Rsa) RsaEncrypt(origData []byte) ([]byte, error)

Rsa加密

Jump to

Keyboard shortcuts

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