post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
|
header for ntru_rnd.c More...
Go to the source code of this file.
Functions | |
int | get_rnd_int (void) |
int | get_urnd_int (void) |
void | ntru_get_rnd_tern_poly_num (fmpz_poly_t poly, const ntru_params *params, uint32_t num_ones, uint32_t num_neg_ones, int(*rnd_int)(void)) |
int get_rnd_int | ( | void | ) |
Get a random integer from /dev/random.
Definition at line 42 of file ntru_rnd.c.
int get_urnd_int | ( | void | ) |
Get a pseudo random integer from /dev/urandom.
Definition at line 66 of file ntru_rnd.c.
void ntru_get_rnd_tern_poly_num | ( | fmpz_poly_t | poly, |
const ntru_params * | params, | ||
uint32_t | num_ones, | ||
uint32_t | num_neg_ones, | ||
int(*)(void) | rnd_int | ||
) |
Get a random ternary polynomial with specified numbers of 1 coefficients and -1 coefficients.
poly | the resulting random polynomial [out] |
params | the NTRU context |
num_ones | the number of 1 coefficients |
num_neg_ones | the number of -1 coefficients |
rnd_int | function callback which should return a random integer |
Definition at line 86 of file ntru_rnd.c.