Documentation
¶
Index ¶
- func Base32Decode(encoded string) ([]byte, error)
- func Base32Encode(data []byte) string
- func Base64Decode(encoded string) ([]byte, error)
- func Base64Encode(data []byte) string
- func CompressRatio(original, compressed []byte) float64
- func GZipDecode(input []byte) ([]byte, error)
- func GZipEncode(input []byte, level ...int) ([]byte, error)
- func GzipDecodeString(input []byte) (string, error)
- func GzipEncodeString(input string, level ...int) ([]byte, error)
- func IsGzipData(data []byte) bool
- func MD5(data []byte) string
- func MD5String(s string) string
- func NewAESCipher(key string, cipherType AESCipherType) (*aesCipher, error)
- func SHA1(data []byte) string
- func SHA1String(s string) string
- func SHA224(data []byte) string
- func SHA224String(s string) string
- func SHA256(data []byte) string
- func SHA256String(s string) string
- func SHA384(data []byte) string
- func SHA384String(s string) string
- func SHA512(data []byte) string
- func SHA512String(s string) string
- func SHA512_224(data []byte) string
- func SHA512_224String(s string) string
- func SHA512_256(data []byte) string
- func SHA512_256String(s string) string
- type AESCipherType
- type CodecAES
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base32Decode ¶
func Base32Encode ¶
func Base64Decode ¶
func Base64Encode ¶
func CompressRatio ¶
CompressRatio 计算压缩比率(原始大小 / 压缩后大小)
func GZipEncode ¶
GZipEncode 压缩数据到 gzip 格式 支持可选的压缩级别配置
func GzipDecodeString ¶
GzipDecodeString 解压 gzip 数据到字符串
func GzipEncodeString ¶
GzipEncodeString 压缩字符串到 gzip 格式
func NewAESCipher ¶
func NewAESCipher(key string, cipherType AESCipherType) (*aesCipher, error)
* AES 中的 128、192、256 主要是根据密钥长度来区分的,这是三者最核心的区别。具体对应关系如下:
AES-128:使用 128 位(16 字节)的密钥 AES-192:使用 192 位(24 字节)的密钥 AES-256:使用 256 位(32 字节)的密钥
除了密钥长度不同,三者的加密轮数也不同(轮数越多,加密过程越复杂):
AES-128:10 轮加密 AES-192:12 轮加密 AES-256:14 轮加密 * NewAESCipher 创建AES加密器
Types ¶
Click to show internal directories.
Click to hide internal directories.