Function constant_time_eq_ascii_lower
Source pub fn constant_time_eq_ascii_lower(a: &[u8], lower_b: &[u8]) -> bool
Expand description
恒定时间 ASCII 大小写不敏感比较
对两个字节切片做恒定时间、不提前退出的大小写不敏感比较。
用于检测公开命名的敏感模式(如 Password= / Authorization: Bearer )时,
避免因提前退出导致的模式存在性侧信道泄露。
§Arguments
a - 待比较的第一个字节切片(任意大小写)
lower_b - 待比较的第二个字节切片(必须为 ASCII 小写)
§Safety
调用者需保证 lower_b 是已经转换为小写的 ASCII;若 lower_b 含大写,
结果恒为 false,但执行时间依然恒定。