polyfrommsg function
Converts a message (byte array) into a polynomial. Each bit of the message is mapped to a coefficient in the polynomial. If the bit is 1, the corresponding coefficient is set to KYBER_Q/2; otherwise, 0.
Implementation
void polyfrommsg(Poly p, Uint8List msg) {
for (int i = 0; i < KYBER_SYMBYTES; i++) {
for (int j = 0; j < 8; j++) {
int bit = (msg[i] >> j) & 1;
p.coeffs[8 * i + j] = bit * (KYBER_Q ~/ 2);
}
}
}