Skip to main content

constant_time_eq

Function constant_time_eq 

Source
pub fn constant_time_eq(a: &[u8], b: &[u8]) -> bool
Expand description

Constant-time byte comparison to avoid leaking the token via timing.

Length is compared first (and short-circuits), which leaks only the token length — standard and acceptable for a shared secret.