crypto

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(src, key []byte) (dst []byte, err error)

AesDecrypt AES-CBC解密,PKCS#7,传入密文和密钥,[]byte

func AesEncrypt

func AesEncrypt(src []byte, key []byte) ([]byte, error)

AesEncrypt AES-CBC加密+PKCS#7打包,传入明文和密钥

func Base64Decode

func Base64Decode(src string) string

Base64Decode base64解密

func Base64Encode

func Base64Encode(src []byte) string

Base64Encode base64加密

func DesDecrypt

func DesDecrypt(data, key []byte) ([]byte, error)

DesDecrypt Des解密

func DesEncrypt

func DesEncrypt(data, key []byte) ([]byte, error)

DesEncrypt Des加密

func MD5

func MD5(s string, isUpper bool) string

MD5 获取md5字符串

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

PKCS5Padding ...

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

PKCS5UnPadding ...

func PKCS7Pad

func PKCS7Pad(msg []byte, blockSize int) []byte

PKCS7Pad PKCS#7打包

func PKCS7UnPad

func PKCS7UnPad(msg []byte) []byte

PKCS7UnPad PKSC#7解包

func RSADecrypt

func RSADecrypt(data, privateKey []byte) ([]byte, error)

RSADecrypt RSA解密

func RSAEncrypt

func RSAEncrypt(data, publicKey []byte) ([]byte, error)

RSAEncrypt RSA加密

func RSAPublicKey

func RSAPublicKey(path string) (string, error)

RSAPublicKey ...

func RSAPublicKeyOrigin

func RSAPublicKeyOrigin(path string) (string, error)

RSAPublicKeyOrigin ...

func SHA1

func SHA1(s string, isUpper bool) string

SHA1 获取sha1字符串

func SHA512

func SHA512(s string) string

SHA512 获取sha512字符串

func SignHMAC

func SignHMAC(params []*Param, secret string) string

SignHMAC 生成HMAC签名

Types

type Param

type Param struct {
	Key   string
	Value string
}

Param 参数对象

Jump to

Keyboard shortcuts

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