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"))}")
}Вывод
true false
pub(api) fn constantTimeEq(a: bytes, b: bytes) -> boolС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
a | bytes |
b | bytes |
Возвращает
bool
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/crypto/crypto.oxl:316