Skip to main content

constant_time_compare

Function constant_time_compare 

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

Returns true iff a and b contain the same bytes. It takes an amount of time dependent on the lengths, but independent of the contents of the slices a and b. The return type is a bool, since unlike memcmp in C this function cannot be used to put elements into a defined order.