post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
|
header for ntru_ascii_poly.c More...
#include "ntru_common.h"
#include "ntru_string.h"
#include "ntru_params.h"
#include <fmpz_poly.h>
#include <fmpz.h>
Go to the source code of this file.
Functions | |
fmpz_poly_t * | ascii_bin_to_bin_poly (const char *to_poly, const ntru_params *params) |
fmpz_poly_t ** | ascii_to_bin_poly_arr (const string *to_poly, const ntru_params *params) |
fmpz_poly_t ** | base64_to_poly_arr (const string *to_poly, const ntru_params *params) |
header for ntru_ascii_poly.c
Header for the internal API of ntru_ascii_poly.c.
Definition in file ntru_ascii_poly.h.
fmpz_poly_t* ascii_bin_to_bin_poly | ( | const char * | to_poly, |
const ntru_params * | params | ||
) |
Convert a "binary" ascii string to a binary polyomial. The ascii string will be converted to a binary representation and the following mapping will apply between binary -> poly:
1 => 1
0 => -1
If the polynomial is of degree less than N -1, then it will be filled with trailing 2's for later use in bin_poly_to_ascii().
to_poly | the string to get into binary polynomial format |
params | the NTRUEncrypt context |
Definition at line 81 of file ntru_ascii_poly.c.
fmpz_poly_t** ascii_to_bin_poly_arr | ( | const string * | to_poly, |
const ntru_params * | params | ||
) |
Convert an ascii string to an array of binary polyomials. The ascii string will be converted to a binary representation and the following mapping will apply between binary -> poly:
1 => 1
0 => -1
If the last polynomial is of degree less than N -1, then it will be filled with trailing 2's for later use in bin_poly_arr_to_ascii().
to_poly | the string to get into binary polynomial format |
params | the NTRUEncrypt context |
Definition at line 101 of file ntru_ascii_poly.c.
fmpz_poly_t** base64_to_poly_arr | ( | const string * | to_poly, |
const ntru_params * | params | ||
) |
Convert an base64 encoded string to an array of polyomials with coefficients which are expected to be in the range [0, q-1]. The chars will be converted (after decoding) to their integer representation and directly put into the coefficients.
If the last polynomial is of degree less than N -1, then it will be filled with trailing q's for later user in poly_arr_to_base64().
to_poly | the string to get into polynomial format, which is of type string, so we can iterate safely over it (the string might have null-bytes in the middle of it) |
params | the NTRUEncrypt context |
Definition at line 146 of file ntru_ascii_poly.c.