testKey method

int testKey(
  1. List<int> key
)

Used as part of testsuite to compare provided keys.

This function will sequentially check each entry.

Returns: -1 on success, or which entry failed verification.

On failure it will print to the console what failed

Implementation

int testKey(List<int> key) {
  for (int i = 0; i < key.length; i++) {
    int v0 = _xteaKey[i];
    int v1 = key[i];

    if (v0 != v1) {
      print(
          "FATAL: TestKey XTEA failed at position ${i}.\nExpected: ${v1}\nActual: ${v0}");

      return i;
    }
  }

  return -1;
}