Skip to main content

constant_time_eq

Function constant_time_eq 

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

Compares two secrets in time that does not depend on where they first differ.

subtle, not a hand-rolled fold: a comparison the optimiser is free to turn back into an early return is a comparison that leaks how much of a secret a caller guessed right.