Fcrand (Go language): drop-in replacement for crypto/rand, up to 10x faster
10 months ago
- #Go
- #cryptography
- #performance
- fcrand 是 Go 语言 crypto/rand 的高性能直接替代方案
- 对于≤512字节的随机数据请求,它提供高达10倍的性能提升,同时保持加密安全性
- 100% API 兼容 crypto/rand,实现真正的无缝替换
- 与 crypto/rand 相同,零配置且线程安全
- 通过 `go get -u github.com/sdrapkin/fcrand` 安装,导入方式为 `rand "github.com/sdrapkin/fcrand"`
- 支持 FIPS-140 标准,通过环境变量 `GODEBUG=fips140=on` 启用
- 性能基准测试显示小数据请求有显著加速,512+字节时回退至 crypto/rand 的性能水平
- 包含增强功能方法如 `.Text()` 和 `.Prime()`