fn constantTimeEq
Compares two byte strings in time that does not depend on where they differ (different lengths are unequal at once).
Example:
use std.crypto { constantTimeEq }
use std.ser { bytesOf }
fn main() io {
print("{constantTimeEq(bytesOf(&"a"), bytesOf(&"a"))} {constantTimeEq(bytesOf(&"a"), bytesOf(&"b"))}")
}Output
true false
pub(api) fn constantTimeEq(a: bytes, b: bytes) -> boolSince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
a | bytes |
b | bytes |
Returns
bool
Effects
none declared (pure unless the body says otherwise)
Defined in: std/crypto/crypto.oxl:316