GaloisField constructor

GaloisField(
  1. int pp,
  2. int size,
  3. int base
)

Implementation

GaloisField(int pp, this.size, this.base) {
  aLogTbl = List<int>.filled(size, 0);
  logTbl = List<int>.filled(size, 0);

  var x = 1;
  for (var i = 0; i < size; i++) {
    aLogTbl[i] = x;
    x = x * 2;
    if (x >= size) {
      x = (x ^ pp) & (size - 1);
    }
  }

  for (var i = 0; i < size; i++) {
    logTbl[aLogTbl[i]] = i;
  }
}