Documentation
¶
Index ¶
- Constants
- func BrZip(data []byte, quality int) ([]byte, error)
- func BrZipFile(src, dst string, quality int) error
- func Compress(body []byte, compressMethod string, compressType string) (bool, []byte, error)
- func GZip(data []byte) ([]byte, error)
- func GZipFile(src, dst string) error
- func GoDataAesCTRTransformDecode(data []byte, aesKey []byte, aesIv []byte, compressMethod string) ([]byte, error)
- func GoDataAesCTRTransformEncode(data []byte, aesKey []byte, aesIv []byte, compressMethod string) ([]byte, error)
- func GoDataDecrypt(data []byte, AesKey []byte, compressMethod string) ([]byte, error)
- func GoDataEncrypt(data []byte, AesKey []byte, compressMethod string) ([]byte, error)
- func UnBrZip(compressedData []byte) ([]byte, error)
- func UnBrZipFile(src, dst string) error
- func UnGZip(compressedData []byte) ([]byte, error)
- func UnGZipFile(src, dst string) error
Constants ¶
View Source
const ( XNlContentEncoding = "X-NL-Content-Encoding" //默认Header 压缩标识 NOZIP = "nozip" //不压缩 GZIP = "gzip" BR = "br" GoZipNoType = "__nozip__" //默认Header 压缩标识 GoZipType = "__zip__" //默认Header 压缩标识 UnGoZipType = "__unzip__" //默认Header 压缩标识 )
xNlContentEncoding: br, gzip
Variables ¶
This section is empty.
Functions ¶
func GoDataAesCTRTransformDecode ¶ added in v1.2.209
func GoDataAesCTRTransformEncode ¶ added in v1.2.209
func GoDataAesCTRTransformEncode(data []byte, aesKey []byte, aesIv []byte, compressMethod string) ([]byte, error)
加密和解密AesCtr(zip(data))
compressMethod 空时不会压缩和解压
func GoDataDecrypt ¶ added in v1.2.202
解密:
1. 先取前16个字节,作为AES的IV
2. 取剩余的字节解密
3. 取前8个字节,作为时间戳
4. 取剩余的字节
5. 解压data(如果有压缩)
func GoDataEncrypt ¶ added in v1.2.202
AesIv 动态生成 (aes(time+zip(data)))
1. 先时间戳 time
2. 生成16位随机IV
3. 压缩data(如果有压缩) zip(data)
4. 加密data: aes(time+zip(data))
5. 拼接iv+encryptData
func UnBrZipFile ¶ added in v1.2.200
func UnGZipFile ¶ added in v1.2.200
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.