crypto

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: GPL-3.0 Imports: 9 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESDecrypt

func AESDecrypt(ciphertext, key []byte) ([]byte, error)

AESDecrypt AES加密 plantText 密码 key密钥 16字节,24字节,32字节 return 明文

func AESEncrypt

func AESEncrypt(plantText, key []byte) ([]byte, error)

AESEncrypt AES加密 plantText 明文 key密钥 16字节,24字节,32字节 return 密文

func GetMD5

func GetMD5(str string) (md5str string)

MD5 加密

func HmacMD5

func HmacMD5(secret string, data []byte) []byte

HmacMD5 加密

func HmacSHA1

func HmacSHA1(secret string, data []byte) []byte

HmacSHA1 加密

func Keccak256

func Keccak256(data ...[]byte) []byte

Keccak256 calculates and returns the Keccak256 hash of the input data.

func MD5

func MD5(data []byte) []byte

MD5 加密

func PKCS7Padding

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

PKCS7Padding PKCS7填充 ciphertext 明文 blockSize 分组大小 return 填充后的明文

func PKCS7UnPadding

func PKCS7UnPadding(plantText []byte, blockSize int) []byte

PKCS7UnPadding PKCS7清理填充 ciphertext 填充后的明文 blockSize 分组大小 return 恢复后的明文

func SHA1

func SHA1(data []byte) []byte

SHA1 加密

func SHA256

func SHA256(data []byte) []byte

SHA256 加密

Types

type AESProtocal

type AESProtocal interface {
	AES(key string) (string, error)
	UnAES(aesBase64string string, key string) error
}

AESProtocal String扩展,获得AES加密方法

Directories

Path Synopsis
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.

Jump to

Keyboard shortcuts

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