references/kyber-submission-nist-round2/NIST-PQ-Submission-Kyber-20190330/Reference_Implementation/crypto_kem/kyber768/poly.c
/*************************************************
* Name:        poly_frombytes
*
* Description: De-serialization of a polynomial;
*              inverse of poly_tobytes
*
* Arguments:   - poly *r:                pointer to output polynomial
*              - const unsigned char *a: pointer to input byte array (of KYBER_POLYBYTES bytes)
**************************************************/
poly_frombytes
Description: De-serialization of a polynomial;
inverse of poly_tobytes

- poly *r:                pointer to output polynomial
const unsigned char *a: pointer to input byte array (of KYBER_POLYBYTES bytes)
poly_frombytes Description : De - serialization of a polynomial ; inverse of poly_tobytes - poly * r : pointer to output polynomial const unsigned char * a : pointer to input byte array ( of KYBER_POLYBYTES bytes )
void poly_frombytes(poly *r, const unsigned char *a)
{
  int i;
  for(i=0;i<KYBER_N/2;i++){
    r->coeffs[2*i]   = a[3*i]        | ((uint16_t)a[3*i+1] & 0x0f) << 8;
    r->coeffs[2*i+1] = a[3*i+1] >> 4 | ((uint16_t)a[3*i+2] & 0xff) << 4;
  }
}
void poly_frombytes ( poly * r , const unsigned char * a ) { int i ; for ( i = 0 ; i < KYBER_N / 2 ; i ++ ) { r -> coeffs [ 2 * i ] = a [ 3 * i ] | ( ( uint16_t ) a [ 3 * i + 1 ] & 0x0f ) << 8 ; r -> coeffs [ 2 * i + 1 ] = a [ 3 * i + 1 ] >> 4 | ( ( uint16_t ) a [ 3 * i + 2 ] & 0xff ) << 4 ; } }
Name:        poly_frombytes
Description: De-serialization of a polynomial;
inverse of poly_tobytes
Name : poly_frombytes Description : De - serialization of a polynomial ; inverse of poly_tobytes