Documentation ¶
Index ¶
- func AesCBCDecode(key, iv, ciphertext []byte) ([]byte, error)
- func AesCBCDecodeBase64(key, iv []byte, ciphertext string) ([]byte, error)
- func AesCBCDecodeHex(key, iv []byte, ciphertext string) ([]byte, error)
- func AesCBCEncode(key, iv, plaintext []byte) ([]byte, error)
- func AesCBCEncodeBase64(key, iv, plaintext []byte) (string, error)
- func AesCBCEncodeHex(key, iv, plaintext []byte) (string, error)
- func Base64Decode(str string) ([]byte, error)
- func Base64Encode(str string) string
- func Base64EncodeByte(b []byte) string
- func HmacMd5(str, key string) string
- func HmacMd5Byte(b, key []byte) string
- func HmacSha1(str, key string) string
- func HmacSha1Byte(b, key []byte) string
- func HmacSha256(str, key string) string
- func HmacSha256Byte(b, key []byte) string
- func HmacSha512(str, key string) string
- func HmacSha512Byte(b, key []byte) string
- func Md5(str string) string
- func Md5Byte(b []byte) string
- func Sha1(str string) string
- func Sha1Byte(b []byte) string
- func Sha224(str string) string
- func Sha224Byte(b []byte) string
- func Sha256(str string) string
- func Sha256Byte(b []byte) string
- func Sha384(str string) string
- func Sha384Byte(b []byte) string
- func Sha512(str string) string
- func Sha512Byte(b []byte) string
- func URLDecode(str string) string
- func URLEncode(str string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesCBCDecode ¶
AesCBCDecode ..
key: 密钥,长度需要为 16, 24, 或者 32
iv: 向量长度,长度必须为 16
ciphertext: 待解密的内容
func AesCBCDecodeBase64 ¶
AesCBCDecodeBase64 ..
key: 密钥,长度需要为 16, 24, 或者 32
iv: 向量长度,长度必须为 16
ciphertext: 待解密的内容(格式为 base64)
func AesCBCDecodeHex ¶
AesCBCDecodeHex ..
key: 密钥,长度需要为 16, 24, 或者 32
iv: 向量长度,长度必须为 16
ciphertext: 待解密的内容(格式为 hex)
eg: ciphertextHex := "ae5d9a1e7e4260832cba80647b1e788d" ciphertextBase64 := "rl2aHn5CYIMsuoBkex54jQ=="
key := []byte("1234567890123456") iv := []byte("1234567890123456")
plaintextHex, _ := AesCBCDecodeHex(key, iv, ciphertextHex)
output: // plaintextHex => abcdefg
func AesCBCEncodeBase64 ¶
AesCBCEncodeBase64 ..
key: 密钥,长度需要为 16, 24, 或者 32
iv: 向量长度,长度必须为 16
plaintext: 待加密的内容
return: base64
func AesCBCEncodeHex ¶
AesCBCEncodeHex ..
key: 密钥,长度需要为 16, 24, 或者 32
iv: 向量长度,长度必须为 16
plaintext: 待加密的内容
return: 16进制
eg: plaintext := []byte("abcdefg")
key := []byte("1234567890123456") iv := []byte("1234567890123456")
ciphertextHex, _ := AesCBCEncodeHex(key, iv, plaintext)
output: ciphertextHex -> ae5d9a1e7e4260832cba80647b1e788d
func Base64Encode ¶
Base64Encode base64 编码
eg: Base64Encode("https://www.keylala.cn/json?str=hello world")
-> aHR0cHM6Ly93d3cua2V5bGFsYS5jbi9qc29uP3N0cj1oZWxsbyB3b3JsZA==
func HmacMd5 ¶
HmacMd5 对指定内容生成信息摘要
eg: HmacMd5("123456", "abcdef")
-> c6bdcc80c381536a3e85f2ee5f71cebb
func HmacSha1 ¶
HmacSha1 对指定内容生成信息摘要
eg: HmacSha1("123456", "abcdef")
-> b8466fbb9634771d25d8ddd1242484bdb748b179
func HmacSha256 ¶
HmacSha256 对指定内容生成信息摘要
eg: HmacSha256("123456", "abcdef")
-> ec4a11a5568e5cfdb5fbfe7152e8920d7bad864a0645c57fe49046a3e81ec91d
func HmacSha512 ¶
HmacSha512 对指定内容生成信息摘要
eg: HmacSha512("123456", "abcdef")
-> 130a4caafb11b798dd7528628d21f742feaad266e66141cc2ac003f0e6437cb57 49245af8a3018d354e4b55e14703a5966808438afe4aae516d2824b014b5902
func Sha224 ¶
Sha224 对指定内容生成信息摘要
eg: Sha224("123456") -> f8cdb04495ded47615258f9dc6a3f4707fd2405434fefc3cbf4ef4e6
func Sha256 ¶
Sha256 对指定内容生成信息摘要
eg: Sha256("123456") -> 8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92
func Sha384 ¶
Sha384 对指定内容生成信息摘要
eg: Sha384("123456")
-> 0a989ebc4a77b56a6e2bb7b19d995d185ce44090c13e2984b7ecc6d446d4b61ea9991b76a4c2f04b1 b4d244841449454
func Sha512 ¶
Sha512 对指定内容生成信息摘要
eg: Sha512("123456")
-> ba3253876aed6bc22d4a6ff53d8406c6ad864195ed144ab5c87621b6c233b548baeae6956df346ec8c 17f5ea10f35ee3cbc514797ed7ddd3145464e2a0bab413
Types ¶
This section is empty.