gocrypto

package
v1.2.168 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashingAlgorithmMd5    = "md5"
	HashingAlgorithmSha1   = "sha1"
	HashingAlgorithmSha256 = "sha256"
	HashingAlgorithmSha512 = "sha512"
)
View Source
const (
	EncodingHex    = "hex"
	EncodingBase64 = "base64"
)

Variables

This section is empty.

Functions

func AESCBCDecrypt

func AESCBCDecrypt(cipherData, key, iv []byte) ([]byte, error)

func AESCBCEncrypt

func AESCBCEncrypt(rawData, key, iv []byte) ([]byte, error)

func AESECBDecrypt

func AESECBDecrypt(buf, key []byte) ([]byte, error)

func AESECBEncrypt

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

func Base59Decoding

func Base59Decoding(strByte []byte, key ...string) []byte

func Base59Encoding

func Base59Encoding(strByte []byte, key ...string) string

如果遇到特殊字符,需要用 url.PathEscape(str) 解决

func Base64Decode

func Base64Decode(str string) []byte

func Base64Encode

func Base64Encode(buf []byte) string

func CalculateFileMD5

func CalculateFileMD5(filePath string) (string, error)

计算文件md5(支持超大文件)

func CreateHash

func CreateHash(data []byte, hashingAlgorithm string, encoding string) (string, error)

CreateHash 计算文件的哈希值 data: 输入数据 hashingAlgorithm: 哈希算法名称 ("md5", "sha1", "sha256", "sha512" 等) encoding: 编码方式 ("hex" 或 "base64")

func GenerateAESKey

func GenerateAESKey() (string, error)

生成 AES 密钥

func GenerateAESKeyAndIV

func GenerateAESKeyAndIV() (string, string, error)

生成 AES 密钥和 IV

func HMacMd5

func HMacMd5(buf, key []byte) string

func HMacSha1

func HMacSha1(buf, key []byte) string

func HMacSha256

func HMacSha256(buf, key []byte) string

func MD5

func MD5(buf []byte) string

MD5 大写

func Md5

func Md5(buf []byte) string

Md5小写

func SHA1

func SHA1(buf []byte) string

小写

func SHA256

func SHA256(buf, key []byte) string

func SHAWithRSA

func SHAWithRSA(key, data []byte) (string, error)

func SessionId

func SessionId() string

func UrlDecode

func UrlDecode(str string) string

func UrlEncode

func UrlEncode(str string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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