Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AES ¶
type AES struct{}
AES 实现了 Crypto 接口,提供基于 AES-GCM 模式的加解密功能 使用 Galois/Counter Mode (GCM) 提供认证加密
type Crypto ¶
type Crypto interface {
// Encrypt 加密数据
// data: 原始数据
// key: 加密密钥
// 返回加密后的数据,若出错返回 error
Encrypt(data []byte, key []byte) ([]byte, error)
// Decrypt 解密数据
// data: 密文数据
// key: 解密密钥
// 返回解密后的原始数据,若出错返回 error
Decrypt(data []byte, key []byte) ([]byte, error)
}
Crypto 定义通用加解密接口 注意:不同的实现可能对 data 和 key 有不同的长度或格式要求
type MD5 ¶
type MD5 struct{}
MD5 提供 MD5 哈希计算功能 注意:MD5 已被认为不再安全,仅建议用于非安全敏感场景(如文件完整性校验、简单的指纹生成) 该结构体未实现 Crypto 接口,因为其 Encrypt 方法签名不同
Click to show internal directories.
Click to hide internal directories.