docs: sync crypto and crypto-sm v1.1.0 API guide (by AI)

This commit is contained in:
AI Engineer 2026-05-07 20:59:34 +08:00
parent 5c23d5673a
commit ae9ce97360

View File

@ -6,27 +6,34 @@
| 项目 | 版本 | 核心能力 | 依赖 | 详细技术手册 | | 项目 | 版本 | 核心能力 | 依赖 | 详细技术手册 |
| :--- | :--- | :--- | :--- | :--- | | :--- | :--- | :--- | :--- | :--- |
| **go/cast** | v1.2.6 | 语义化强转; 万能转换; 泛型工具; 智能序列化; 时区和时间万能转化; 深度合并覆盖等 | - | [./cast/README.md](https://apigo.cc/go/cast) | | **go/cast** | v1.2.8 | 语义化强转; 万能转换; 泛型工具; 智能序列化; 时区和时间万能转化; 深度合并覆盖等 | - | [./cast/README.md](https://apigo.cc/go/cast) |
| **go/timer** | v1.0.5 | 高性能时间流管控引擎; 耗时打点; 退避重试; 时间轮; 防抖节流; 超时监控 | cast | [./timer/README.md](https://apigo.cc/go/timer) | | **go/timer** | v1.0.6 | 高性能时间流管控引擎; 耗时打点; 退避重试; 时间轮; 防抖节流; 超时监控 | cast | [./timer/README.md](https://apigo.cc/go/timer) |
| **go/rand** | v1.0.4 | 高并发随机; 闭区间生成; 洗牌 | - | [./rand/README.md](https://apigo.cc/go/rand) | | **go/rand** | v1.0.5 | 高并发随机; 闭区间生成; 洗牌 | - | [./rand/README.md](https://apigo.cc/go/rand) |
| **go/encoding** | v1.0.4 | Hex/Base64/Int 编解码 | - | [./encoding/README.md](https://apigo.cc/go/encoding) | | **go/encoding** | v1.0.6 | Hex/Base64/URL/Int 编解码; 消除摩擦 | cast | [./encoding/README.md](https://apigo.cc/go/encoding) |
| **go/safe** | v1.0.4 | 内存保护; 防 Dump; 安全擦除; 混淆 | rand | [./safe/README.md](https://apigo.cc/go/safe) | | **go/safe** | v1.0.5 | 内存保护; 防 Dump; 安全擦除; 混淆 | rand | [./safe/README.md](https://apigo.cc/go/safe) |
| **go/crypto** | v1.0.4 | 主流算法; 混合加密; 内存防御 | safe, encoding | [./crypto/README.md](https://apigo.cc/go/crypto) | | **go/crypto** | v1.1.0 | 主流算法; 混合加密; 内存防御; 消除摩擦 | safe, encoding, cast | [./crypto/README.md](https://apigo.cc/go/crypto) |
| **go/crypto-sm** | v1.0.4 | 国密 (SM2/3/4); 内存安全实现 | crypto, encoding, safe | [./crypto-sm/README.md](https://apigo.cc/crypto-sm) | | **go/crypto-sm** | v1.1.0 | 国密 (SM2/3/4); 内存安全实现; 消除摩擦 | crypto, encoding, safe, cast | [./crypto-sm/README.md](https://apigo.cc/crypto-sm) |
| **go/id** | v1.0.4 | 分布式 ID; 数据库优化 | encoding, rand | [./id/README.md](https://apigo.cc/id) | | **go/id** | v1.0.5 | 分布式 ID; 数据库优化 | encoding, rand | [./id/README.md](https://apigo.cc/id) |
| **go/file** | v1.0.4 | 高性能 IO; 智能序列化; 内存资源加密 | convert, encoding, safe | [./file/README.md](https://apigo.cc/file) | | **go/file** | v1.0.7 | 高性能 IO; 智能序列化; 内存资源加密; 消除摩擦 | cast, convert, encoding, safe | [./file/README.md](https://apigo.cc/file) |
| **go/shell** | v1.0.4 | 终端样式; 命令执行; 命令链管道 | cast | [./shell/README.md](https://apigo.cc/go/shell) | | **go/shell** | v1.0.5 | 终端样式; 命令执行; 命令链管道 | cast | [./shell/README.md](https://apigo.cc/go/shell) |
| **go/config** | v1.0.5 | 文件配置加载; 环境覆盖; 结构映射 | cast, convert, file | [./config/README.md](https://apigo.cc/go/config) | | **go/config** | v1.0.6 | 文件配置加载; 环境覆盖; 结构映射 | cast, convert, file | [./config/README.md](https://apigo.cc/go/config) |
| **go/log** | v1.1.1 | 高性能日志; 脱敏; 多输出渠道 | cast, config, shell | [./log/README.md](https://apigo.cc/go/log) | | **go/log** | v1.1.9 | 高性能 Meta 驱动日志; JSON 数组序列化; 脱敏; 独立可视化工具 (logv) | cast, config, shell | [./log/README.md](https://apigo.cc/go/log) |
| **go/http** | v1.0.3 | 高性能 HTTP 客户端; 泛型绑定; 自动透传 | cast, convert, file, log | [./http/README.md](https://apigo.cc/go/http) | | **go/http** | v1.0.6 | 高性能 HTTP 客户端; 泛型绑定; 自动透传 | cast, convert, file, log | [./http/README.md](https://apigo.cc/go/http) |
| **go/db** | v1.0.4 | 极简数据库抽象; 自动绑定; 读写分离; 自动 ID 生成 | cast, config, convert, crypto, id, log, rand, safe, shell | [./db/README.md](https://apigo.cc/go/db) | | **go/db** | v1.0.8 | 极简数据库抽象; 自动绑定; 读写分离; 自动 ID 生成 | cast, config, convert, crypto, id, log, rand, safe, shell | [./db/README.md](https://apigo.cc/go/db) |
| **go/redis** | v1.0.3 | 高性能 Redis 客户端; 分布式 ID; 发布订阅 | cast, config, crypto, id, log, safe | [./redis/README.md](https://apigo.cc/go/redis) | | **go/redis** | v1.0.5 | 高性能 Redis 客户端; 分布式 ID; 发布订阅 | cast, config, crypto, id, log, safe | [./redis/README.md](https://apigo.cc/go/redis) |
| **go/discover** | v1.0.5 | 服务发现与负载均衡; 自动透传; H2C/WS 支持 | cast, config, http, log, redis | [./discover/README.md](https://apigo.cc/go/discover) | | **go/discover** | v1.0.7 | 服务发现与负载均衡; 自动透传; H2C/WS 支持 | cast, config, http, log, redis | [./discover/README.md](https://apigo.cc/go/discover) |
| **go/watch** | v1.1.1 | 高性能、AI 友好的文件监听库; 递归监听; 灵活过滤 | file, timer | [./watch/README.md](https://apigo.cc/go/watch) |
--- ---
## API 指南 ## API 指南
### watch (高性能文件监听)
- **意图**: AI 友好的文件系统事件监控,支持复杂的包含/排除过滤。
- **API**:
- **核心**: Start, EasyStart
- **对象**: Event (Path, Type, IsDir), Watcher (Add, Remove, Stop, WatchList)
### discover (服务发现与负载均衡) ### discover (服务发现与负载均衡)
- **意图**: 极简、自动化的服务发现与微服务调用层。 - **意图**: 极简、自动化的服务发现与微服务调用层。
- **API**: - **API**:
@ -74,15 +81,15 @@
### crypto (通用加解密与Hash) ### crypto (通用加解密与Hash)
- **意图**: 混合加密体系,强制执行内存安全与资源闭环。 - **意图**: 混合加密体系,强制执行内存安全与资源闭环。
- **API**: NewSymmetric, NewSymmetricAndEraseKey, NewAESCBC, NewAESGCM, NewAsymmetric, NewRSA, NewECDSA, NewED25519, NewX25519, EncryptBytes, MustEncrypt, DecryptBytes, MustDecrypt, TryDecrypt, Sign, MustSign, Verify, MustVerify, GenerateKeyPair, MD5, Sha256, Sha512, HmacSha256, Pkcs5Padding, AnsiX923Padding - **API**: NewSymmetric, NewSymmetricAndEraseKey, NewAESCBC, NewAESGCM, NewAESCBCByPassword, NewAESGCMByPassword, NewAsymmetric, NewRSA, NewECDSA, NewED25519, NewX25519, NewRSAByPassword, NewECDSAByPassword, NewED25519ByPassword, NewX25519ByPassword, EncryptBytes, DecryptBytes, TryDecrypt, Sign, Verify, GenerateRSAKeyPair, GenerateECDSAKeyPair, GenerateEd25519KeyPair, GenerateX25519KeyPair, MD5, Sha256, Sha512, HmacSha256, Pkcs5Padding, AnsiX923Padding
### crypto-sm (国密专项) ### crypto-sm (国密专项)
- **意图**: 完全对齐 `go/crypto` 接口,覆盖 SM2/3/4 国密标准。 - **意图**: 完全对齐 `go/crypto` 接口,覆盖 SM2/3/4 国密标准。
- **API**: NewSM2, NewSM2AndEraseKey, GenerateSM2KeyPair, Sm3, Sm3ToHex, Sm3ToBase64, NewSM4CBC, NewSM4GCM, Encrypt, Decrypt - **API**: NewSM2, NewSM2AndEraseKey, NewSM2ByPassword, GenerateSM2KeyPair, Sm3, Sm3ToHex, Sm3ToBase64, NewSM4CBC, NewSM4GCM, NewSM4CBCByPassword, NewSM4GCMByPassword, Encrypt, Decrypt
### encoding (编解码引擎) ### encoding (编解码引擎)
- **意图**: 语义明确的编解码工具,支持二进制链路与整数填充编码。 - **意图**: 语义明确的编解码工具,支持二进制链路与整数填充编码。
- **API**: Hex, HexToString, MustUnHex, MustUnHexFromString, Base64, Base64ToString, UrlBase64, UrlBase64ToString, MustUnBase64, MustUnUrlBase64, UrlEncode, MustUnUrlEncode, HtmlEscape, MustUnHtmlEscape, Utf8Valid, NewIntEncoder, EncodeInt, AppendInt, DecodeInt, FillInt, ExchangeInt, HashInt - **API**: Hex, HexToString, UnHex, UnHexFromString, Base64, Base64ToString, UnBase64, UnBase64FromString, UrlBase64, UrlBase64ToString, UnUrlBase64, UnUrlBase64FromString, UrlEncode, UnUrlEncode, HtmlEscape, HtmlUnescape, Utf8Valid, NewIntEncoder, EncodeInt, AppendInt, DecodeInt, FillInt, ExchangeInt, HashInt
### id (分布式与数据库ID) ### id (分布式与数据库ID)
- **意图**: 生成唯一标识符,包含针对 MySQL/PostgreSQL 的写入性能优化。 - **意图**: 生成唯一标识符,包含针对 MySQL/PostgreSQL 的写入性能优化。
@ -90,7 +97,7 @@
### file (IO 与 内存文件系统) ### file (IO 与 内存文件系统)
- **意图**: 高性能磁盘 IO、智能序列化及嵌入式资源管理。 - **意图**: 高性能磁盘 IO、智能序列化及嵌入式资源管理。
- **API**: Exists, ReadBytes, MustReadBytes, Read, MustRead, ReadLines, WriteBytes, Write, Copy, CopyToFile, Remove, Move, Replace, Search, ReadDir, UnmarshalFile, MarshalFile, MarshalFilePretty, PatchFile, Compress, Decompress, Archive, Extract, AddFileToMemory, SafeLoadFileToMemory, LoadFilesToMemoryFromB64, LoadFilesToMemoryFromJSON - **API**: Exists, ReadBytes, Read, ReadLines, WriteBytes, Write, Copy, CopyToFile, Remove, Move, Replace, Search, ReadDir, UnmarshalFile, MarshalFile, MarshalFilePretty, PatchFile, Compress, Decompress, Archive, Extract, AddFileToMemory, SafeLoadFileToMemory, LoadFilesToMemoryFromB64, LoadFilesToMemoryFromJSON
### safe (内存安全闭环) ### safe (内存安全闭环)
- **意图**: 提供底层内存保护、防核心转储及敏感数据安全擦除。 - **意图**: 提供底层内存保护、防核心转储及敏感数据安全擦除。