Skip to main content

constant_time_eq

Function constant_time_eq 

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

恒定时间字节切片比较

遍历所有字节,使用 XOR + OR 累积差异位, 不进行提前返回。

§Arguments

  • a - 第一个字节切片
  • b - 第二个字节切片

§Returns

  • bool - 是否相等