Registry / crypto / subtle

subtle

JSON →
library2.6.1rscratesunverified

Pure-Rust traits and utilities for constant-time cryptographic implementations.

# Cargo.toml [dependencies] subtle = "2.6.1"
INSTALL
IMPORT
SIG · SUBTLE
S
subtle
cryptorustv2.6.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ConstantTimeEq
use subtle::ConstantTimeEq;

Compare two byte slices in constant time to prevent timing attacks.

use subtle::ConstantTimeEq; fn main() { let a = b"secret"; let b = b"secret"; println!("{}", a.ct_eq(b).unwrap_u8()); }
Debug
Known issues
gotchaUsing `ConstantTimeEq` on non-constant-time types (e.g., `Vec<u8>`) may not be constant-time if the type's comparison is not constant-time.
fix
Ensure the underlying type implements `ConstantTimeEq` correctly; prefer fixed-size arrays or `subtle::Choice`.
affects: >=2.0.0
Upgrade
Version history
2.6.1latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
16
Amazon
1
Resources
subtle — cargo add subtle · libregistry