Import std.crypto.random
ConstantTimeEquals
function
Public Function ConstantTimeEquals(a: UInt8[], b: UInt8[]): Bool
Whether a and b have the same bytes, in a time that depends only on their counts, not on
where they first differ, so comparing a secret, like a MAC, tells nothing about it.
Examples
Local secret = SecureRandom.Bytes(32)
Expect(ConstantTimeEquals(secret, secret.Clone()))
Expect(!ConstantTimeEquals(secret, SecureRandom.Bytes(32)))Report an issue with this page or with FutureBlitz on GitHub.