post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
|
header for ntru_poly_ascii.c More...
#include "ntru_common.h"
#include "ntru_params.h"
#include "ntru_string.h"
#include <fmpz_poly.h>
#include <fmpz.h>
Go to the source code of this file.
Functions | |
string * | bin_poly_to_ascii (const fmpz_poly_t poly, const ntru_params *params) |
string * | bin_poly_arr_to_ascii (const fmpz_poly_t **bin_poly_arr, const uint32_t poly_c, const ntru_params *params) |
string * | poly_to_ascii (const fmpz_poly_t poly, const ntru_params *params) |
string * | poly_arr_to_ascii (const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params) |
string * | poly_to_base64 (const fmpz_poly_t poly, const ntru_params *params) |
string * | poly_arr_to_base64 (const fmpz_poly_t **poly_arr, const uint32_t poly_c, const ntru_params *params) |
header for ntru_poly_ascii.c
Header for the internal API of ntru_poly_ascii.c.
Definition in file ntru_poly_ascii.h.
string* bin_poly_arr_to_ascii | ( | const fmpz_poly_t ** | bin_poly_arr, |
const uint32_t | poly_c, | ||
const ntru_params * | params | ||
) |
Convert an array of binary polynomials back to a real string. The polynomial coefficients represent a binary format of the ascii string with the following mapping:
1 => 1
-1 => 0
2 => 0
The 2's are only used for filling up the last polynomial, so they will just end up as '\0's at the end of the string and will not confuse the result.
bin_poly_arr | the array of polynomials |
poly_c | the amount of polynomials in bin_poly_arr |
params | the NTRU parameters |
Definition at line 143 of file ntru_poly_ascii.c.
string* bin_poly_to_ascii | ( | const fmpz_poly_t | poly, |
const ntru_params * | params | ||
) |
Convert a single binary polynomial back to a real string. The polynomial coefficients represent a binary format of the ascii string with the following mapping:
1 => 1
-1 => 0
2 => 0
The 2's are only used for filling up the rest of the polynomial, so they will just end up as '\0's at the end of the string and will not confuse the result.
poly | the binary polynomial to convert |
params | the NTRU parameters |
Definition at line 114 of file ntru_poly_ascii.c.
string* poly_arr_to_ascii | ( | const fmpz_poly_t ** | poly_array, |
const uint32_t | poly_c, | ||
const ntru_params * | params | ||
) |
Convert an array of polynomials back to a real string. The polynomial coefficients are expected to be in the range [0, q-1] and will be casted back to chars without any mapping.
Trailing q coefficients are only used for filling up the rest of a polynomial with '\0', so they will not confuse the result.
poly_array | the array of polynomials |
poly_c | the amount of polynomials in poly_arr |
params | the NTRU parameters |
Definition at line 203 of file ntru_poly_ascii.c.
string* poly_arr_to_base64 | ( | const fmpz_poly_t ** | poly_arr, |
const uint32_t | poly_c, | ||
const ntru_params * | params | ||
) |
Convert an array of polynomials back to a real string which is base64 encoded. The polynomial coefficients are expected to be in the range [0, q-1] and will be casted back to chars without any mapping.
Trailing q coefficients are only used for filling up the rest of a polynomial with '\0', so they will not confuse the result.
poly_arr | the array of polynomials |
poly_c | the amount of polynomials in poly_arr |
params | the NTRU parameters |
Definition at line 264 of file ntru_poly_ascii.c.
string* poly_to_ascii | ( | const fmpz_poly_t | poly, |
const ntru_params * | params | ||
) |
Convert a single polynom back to a real string which is ascii encoded (full 256 C char spectrum). The polynomial coefficients are expected to be in the range [0, q-1] and will be casted back to chars without any mapping.
Trailing q coefficients are only used for filling up the rest of a polynomial with '\0', so they will not confuse the result.
poly | the polynomial to convert |
params | the NTRU parameters |
Definition at line 180 of file ntru_poly_ascii.c.
string* poly_to_base64 | ( | const fmpz_poly_t | poly, |
const ntru_params * | params | ||
) |
Convert a single polynom back to a real string which is base64 encoded. The polynomial coefficients are expected to be in the range [0, q-1] and will be casted back to chars without any mapping.
Trailing q coefficients are only used for filling up the rest of a polynomial with '\0', so they will not confuse the result.
poly | the polynomial to convert |
params | the NTRU parameters |
Definition at line 237 of file ntru_poly_ascii.c.