orion-rs/orion

GitHub: orion-rs/orion

Orion 是一个纯 Rust 密码学库,提供简单易用的加密、哈希、密钥派生和密钥协商等功能,致力于减少 unsafe 代码以提高安全性。

Stars: 719 | Forks: 55

# orion [![每日测试](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/cf4cfa1cdc184101.svg)](https://github.com/orion-rs/orion/actions/workflows/daily_tests.yml) [![dudect](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/24925f1013184108.svg)](https://github.com/orion-rs/orion-dudect/actions/workflows/weekly.yml) [![审计](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/44a05f108b184116.svg)](https://github.com/orion-rs/orion/actions/workflows/audit_check.yml) [![codecov](https://codecov.io/gh/orion-rs/orion/branch/master/graph/badge.svg)](https://codecov.io/gh/orion-rs/orion) [![文档](https://docs.rs/orion/badge.svg)](https://docs.rs/orion/) [![Crates.io](https://img.shields.io/crates/v/orion.svg)](https://crates.io/crates/orion) [![Safety Dance](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) [![MSRV](https://img.shields.io/badge/MSRV-1.86-informational.svg)](https://img.shields.io/badge/MSRV-1.86-informational) [![Matrix](https://img.shields.io/matrix/orion-rs:matrix.org.svg?logo=matrix)](https://matrix.to/#/#orion-rs:matrix.org) ### 关于 Orion 是一个用纯 Rust 编写的密码学库。它旨在提供简单易用的加密功能,同时尽量减少 `unsafe` 代码的使用。您可以在[百科](https://github.com/orion-rs/orion/wiki)中阅读更多关于 Orion 的信息。 目前支持: * **AEAD**: (X)ChaCha20-Poly1305。 * **哈希**: BLAKE2b, SHA2, SHA3。 * **XOF**: SHAKE128, SHAKE256。 * **KDF**: HKDF, PBKDF2, Argon2i, scrypt。 * **ECDH**: X25519。 * **MAC**: HMAC, Poly1305。 * **流密码**: (X)ChaCha20。 * **KEM**: X-Wing, ML-KEM, DHKEM(X25519, HKDF-SHA256)。 * **HPKE**: - DHKEM(X25519, HKDF-SHA256), HKDF-SHA256, ChaCha20Poly1305 实验性支持(需启用 `experimental` 特性): * **Committing AEAD**: (X)ChaCha20-Poly1305-BLAKE2b。 ### 安全性 该库**未经过任何第三方安全审计**。使用需**自行承担风险**。 Orion 在 X25519 和 Poly1305 的实现中使用了由 Fiat Crypto 生成的形式化验证算术。 关于正确使用的建议、报告安全问题等事宜,请参阅 [SECURITY.md](https://github.com/orion-rs/orion/blob/master/SECURITY.md)。有关 Orion 安全性的更多信息,请访问[百科](https://github.com/orion-rs/orion/wiki/Security)。 ### 最低支持的 Rust 版本 支持 Rust 1.86 及更高版本,但大部分测试均在最新的稳定版 Rust 上进行。 MSRV 可能随时更改,且不被视为 SemVer 破坏性更新。 ### Crate 特性 - `default`/`safe_api`:所有功能,需要 `std`。 - `serde`:自动启用 `alloc` 特性。 - `alloc`:在未启用 `default`/`safe_api` 时,提供 `hazardous` 模块中的 Argon2i。 - `no_std`:表示不进行堆内存分配的隐式特性。通过禁用默认特性且不选择任何附加特性来启用。 - `zeroize`:切换是否在内部对敏感密钥材料进行清零处理。默认启用。 - `experimental`:这些 API 可能在任何非 SemVer 破坏性更新的版本发布中包含破坏性变更。 有关特性的更详细说明,请参阅[百科](https://github.com/orion-rs/orion/wiki/Crate-features)。 ### 文档 可以在[这里](https://docs.rs/orion)查看,或者通过以下命令构建: ``` RUSTDOCFLAGS='--cfg docsrs' cargo +nightly doc --no-deps --all-features ``` ### 测试与模糊测试 [百科](https://github.com/orion-rs/orion/wiki/Testing-suite)中详细介绍了 Orion 的测试方法。要运行所有测试: ``` cargo test ``` 模糊测试使用 [honggfuzz-rs](https://github.com/rust-fuzz/honggfuzz-rs) 在 [orion-fuzz](https://github.com/orion-rs/orion-fuzz) 中进行。有关如何开始对 Orion 进行模糊测试,请参阅 [orion-fuzz](https://github.com/orion-rs/orion-fuzz)。 常数时间执行测试可在 [orion-dudect](https://github.com/orion-rs/orion-dudect) 和 [orion-sidefuzz](https://github.com/orion-rs/orion-sidefuzz) 中找到。 ### 基准测试 可以[在此处查看](https://github.com/orion-rs/orion/wiki/Benchmarks)对 Orion 性能的预期概述。 可以使用 [Criterion](https://github.com/bheisler/criterion.rs) 对该库进行基准测试,如下所示。所有基准测试都位于 `benches/` 目录下。 ``` cargo bench ``` ### 更新日志 请参阅 [CHANGELOG.md](https://github.com/orion-rs/orion/blob/master/CHANGELOG.md) 列表。 ### 贡献 有关如何为 Orion 贡献的信息,请参阅 [CONTRIBUTING.md](https://github.com/orion-rs/orion/blob/master/CONTRIBUTING.md) 中的指南。 ### 许可证 Orion 采用 MIT 许可证。有关更多信息,请参阅 [`LICENSE`](LICENSE) 文件。
标签:AEAD, Rust, 加密, 可视化界面, 哈希算法, 密码学库, 开发组件, 漏洞扫描器, 网络流量审计, 通知系统