19 lines
350 B
Rust
19 lines
350 B
Rust
//! Unit tests for constant-time comparison in the MAC module.
|
|
|
|
use super::constant_time_eq;
|
|
|
|
#[test]
|
|
fn ct_eq_same() {
|
|
assert!(constant_time_eq(b"hello", b"hello"));
|
|
}
|
|
|
|
#[test]
|
|
fn ct_eq_different() {
|
|
assert!(!constant_time_eq(b"hello", b"Hello"));
|
|
}
|
|
|
|
#[test]
|
|
fn ct_eq_different_lengths() {
|
|
assert!(!constant_time_eq(b"hi", b"hello"));
|
|
}
|