Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

EqualMemConstantTime

function EqualMemConstantTime(const aBuf1, aBuf2; aCount: Integer): Boolean;
Equality test whose running time depends only on Count, never on the CONTENTS of the operands. Use it for every acceptance decision on secret or attacker-supplied material - AEAD tags, MACs, password verifiers - where CompareMem's early exit would leak how many leading bytes matched and let an attacker forge one byte at a time across repeated attempts. Not a general-purpose CompareMem replacement: it always reads all Count bytes and answers equal/not-equal only (no ordering).