Packages / rupm

rs-crypto-constant-time 0.1.0

Constant-time (best effort) byte comparison and selection helpers

Install

cargo add rs-crypto-constant-time --registry rupm

In Ruststudio: Packages, search for rs-crypto-constant-time, Install.

Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.

Versions

README

# rs-crypto-constant-time

Constant-time (best effort) byte comparison and selection helpers

Add it with `rupm add rs-crypto-constant-time` (or `cargo add rs-crypto-constant-time --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!(rs_crypto_constant_time::eq(b"secret", b"secret"));
assert!(!rs_crypto_constant_time::eq(b"secret", b"secreT"));
assert_eq!(rs_crypto_constant_time::select_u32(true, 1, 2), 1);
```