constant_time_eq

Function constant_time_eq 

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

SIMD-accelerated constant-time equality check

Returns true if the two slices are equal, false otherwise. This operation is constant-time to prevent timing side-channel attacks.

§Arguments

  • a - First slice to compare
  • b - Second slice to compare

§Returns

true if slices are equal, false otherwise (including different lengths).