Function constant_time_eq::constant_time_eq_n
source · pub fn constant_time_eq_n<const N: usize>(a: &[u8; N], b: &[u8; N]) -> bool
Expand description
Compares two fixed-size byte strings in constant time.
§Examples
use constant_time_eq::constant_time_eq_n;
assert!(constant_time_eq_n(&[3; 20], &[3; 20]));
assert!(!constant_time_eq_n(&[3; 20], &[7; 20]));