polyfrombytes function
Deserializes a polynomial from a byte array representation.
This function takes a byte array r
and interprets it as a sequence of
coefficients in the polynomial. The coefficients are extracted from the
byte array in chunks of two bytes, each being interpreted as a 16-bit
unsigned integer. The resulting Poly
object has the deserialized
coefficients.
Implementation
Poly polyfrombytes(Uint8List r) {
Poly a = Poly();
for (int i = 0; i < KYBER_N; i++) {
a.coeffs[i] = r[2*i] | (r[2*i+1] << 8);
}
return a;
}