genMatrix function

List<List<Poly>> genMatrix(
  1. Uint8List seed,
  2. bool transposed
)

Implementation

List<List<Poly>> genMatrix(Uint8List seed, bool transposed) {
  List<List<Poly>> A = List<List<Poly>>.generate(
    KYBER_K,
    (_) => List<Poly>.generate(KYBER_K, (_) => Poly()),
  );

  for (int i = 0; i < KYBER_K; i++) {
    for (int j = 0; j < KYBER_K; j++) {
      if (transposed) {
        polyuniform(A[j][i], seed, (j << 8) + i);
      } else {
        polyuniform(A[i][j], seed, (i << 8) + j);
      }
    }
  }
  return A;
}