gozip

package
v1.2.210 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

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 BrZip added in v1.2.200

func BrZip(data []byte, quality int) ([]byte, error)

BR 压缩 压缩数据

func BrZipFile added in v1.2.200

func BrZipFile(src, dst string, quality int) error

func Compress added in v1.2.202

func Compress(body []byte, compressMethod string, compressType string) (bool, []byte, error)

func GZip added in v1.2.199

func GZip(data []byte) ([]byte, error)

func GZipFile added in v1.2.200

func GZipFile(src, dst string) error

func GoDataAesCTRTransformDecode added in v1.2.209

func GoDataAesCTRTransformDecode(data []byte, aesKey []byte, aesIv []byte, compressMethod string) ([]byte, error)

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

func GoDataDecrypt(data []byte, AesKey []byte, compressMethod string) ([]byte, error)

解密:

1. 先取前16个字节,作为AES的IV

2. 取剩余的字节解密

3. 取前8个字节,作为时间戳

4. 取剩余的字节

5. 解压data(如果有压缩)

func GoDataEncrypt added in v1.2.202

func GoDataEncrypt(data []byte, AesKey []byte, compressMethod string) ([]byte, error)

AesIv 动态生成 (aes(time+zip(data)))

1. 先时间戳 time

2. 生成16位随机IV

3. 压缩data(如果有压缩) zip(data)

4. 加密data: aes(time+zip(data))

5. 拼接iv+encryptData

func UnBrZip added in v1.2.200

func UnBrZip(compressedData []byte) ([]byte, error)

解压数据

func UnBrZipFile added in v1.2.200

func UnBrZipFile(src, dst string) error

func UnGZip added in v1.2.200

func UnGZip(compressedData []byte) ([]byte, error)

func UnGZipFile added in v1.2.200

func UnGZipFile(src, dst string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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