constant_time_eq

Function constant_time_eq_32

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

Compares two 256-bit byte strings in constant time.

ยงExamples

use constant_time_eq::constant_time_eq_32;

assert!(constant_time_eq_32(&[3; 32], &[3; 32]));
assert!(!constant_time_eq_32(&[3; 32], &[7; 32]));