constantTimeCompare function

int constantTimeCompare(
  1. List<int> x,
  2. List<int> y
)

Implementation

int constantTimeCompare(List<int> x, List<int> y) {
  if (x.length != y.length) {
    return 0;
  }

  int v = 0;
  for (int i = 0; i < x.length; i++) {
    v |= (x[i] ^ y[i]);
  }

  return constantTimeByteEq(v, 0);
}