OxL Справочник OxL
РусскийEnglish

fn constantTimeEq

Compares two byte strings in time that does not depend on where they differ (different lengths are unequal at once).

Example:

oxl✓ проверяется в CI
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

Параметры

ИмяТип
abytes
bbytes

Возвращает

bool

Эффекты

не объявлены (чистая, пока тело не говорит иное)

Определено в: std/crypto/crypto.oxl:316

См. также