ctEquals static method

bool ctEquals(
  1. List<Uint64> a,
  2. List<Uint64> b
)

XOR-accumulate equality check across two same-length limb lists — avoids short-circuiting on the first differing limb, matching the intent of typical constant-time field-element comparisons.

Implementation

static bool ctEquals(List<Uint64> a, List<Uint64> b) {
  if (a.length != b.length) return false;
  var diff = Uint64.zero;
  for (var i = 0; i < a.length; i++) {
    diff = diff | (a[i] ^ b[i]);
  }
  return diff.isZero;
}