constant-time-tools 0.1.0
Constant-time (best effort) byte comparison and selection helpers
Install
cargo add constant-time-tools --registry rupm
In Ruststudio: Packages, search for constant-time-tools, Install.
Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-22.
Versions
- 0.1.0 2026-11-22
README
# constant-time-tools Constant-time (best effort) byte comparison and selection helpers Add it with `rupm add constant-time-tools` (or `cargo add constant-time-tools --registry rupm`). These helpers avoid data-dependent branches, but safe Rust gives no hard guarantee against the optimiser or the CPU. Treat them as best effort, and use an audited crate for security-critical use. ```rust assert!(constant_time_tools::eq(b"secret", b"secret")); assert!(!constant_time_tools::eq(b"secret", b"secreT")); assert_eq!(constant_time_tools::select_u32(true, 1, 2), 1); ```