polyvectobytes function

Uint8List polyvectobytes(
  1. PolyVec v
)

Converts a polyvec to bytes. Each polynomial is converted with polytobytes and concatenated.

Implementation

Uint8List polyvectobytes(PolyVec v) {
  // polytobytes produce KYBER_POLYBYTES bytes por polinomio
  Uint8List r = Uint8List(KYBER_POLYVECBYTES);
  for (int i = 0; i < KYBER_K; i++) {
    Uint8List t = polytobytes(v.vec[i]);
    r.setRange(i * KYBER_POLYBYTES, (i + 1) * KYBER_POLYBYTES, t);
  }
  return r;
}