{"id":57379,"library":"subtle","title":"subtle","description":"Pure-Rust traits and utilities for constant-time cryptographic implementations.","status":"active","version":"2.6.1","language":"rust","source_language":null,"source_url":"https://github.com/dalek-cryptography/subtle","tags":["crypto","constant-time","security","traits"],"install":[{"cmd":"# Cargo.toml\n[dependencies]\nsubtle = \"2.6.1\"","lang":"toml","label":"Cargo.toml"},{"cmd":"cargo add subtle","lang":"bash","label":"cargo add"}],"dependencies":[],"imports":[{"symbol":"ConstantTimeEq","correct":"use subtle::ConstantTimeEq;"}],"quickstart":{"code":"use subtle::ConstantTimeEq;\n\nfn main() {\n    let a = b\"secret\";\n    let b = b\"secret\";\n    println!(\"{}\", a.ct_eq(b).unwrap_u8());\n}","lang":"rust","description":"Compare two byte slices in constant time to prevent timing attacks."},"warnings":[{"fix":"Ensure the underlying type implements `ConstantTimeEq` correctly; prefer fixed-size arrays or `subtle::Choice`.","message":"Using `ConstantTimeEq` on non-constant-time types (e.g., `Vec<u8>`) may not be constant-time if the type's comparison is not constant-time.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'constant':10,16 'constant-tim':9,15 'crypto':14 'cryptograph':12 'implement':13 'pure':3 'pure-rust':2 'rust':4 'secur':18 'subtl':1 'time':11,17 'trait':5,19 'util':7","created_at":"2026-06-16T15:39:58.350914+00:00","updated_at":"2026-06-16T15:39:58.350914+00:00","problems":[],"ecosystem":"crates","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://dalek.rs/","github":"https://github.com/dalek-cryptography/subtle","docs":"https://docs.rs/subtle/","changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["crypto"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-16","next_check":"2026-12-13","install_tag":null}}