constant_time_eq
constant_time_eq copied to clipboard
Compares two equal-sized byte strings in constant time.
Just fyi the [consistenttime](https://github.com/valarauca/consistenttime) crate looks a bit more developed and saw at least some auditing https://github.com/valarauca/consistenttime/issues/5#issuecomment-272042450
The library currently uses [`core::hint::black_box`](https://doc.rust-lang.org/stable/core/hint/fn.black_box.html) as a fallback optimization barrier when needed for architecture support. However, its documentation specifically recommends against its use for cryptographic or security-focused use cases. It...
Inspired by [a discussion about `subtle` and `constant_time_eq` earlier today](https://github.com/BLAKE3-team/BLAKE3/pull/419), I wanted to try to make this crate Miri-compatible. The `blake3` crate currently [has its own workaround](https://github.com/BLAKE3-team/BLAKE3/blob/479eef82d756221abe9f93077b91ce8cf763c32a/src/lib.rs#L318-L331) for Miri compatibility,...