post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
Functions
/home/travis/build/hasufell/pqc/src/ntru_poly_ascii.h File Reference

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>
Include dependency graph for ntru_poly_ascii.h:

Go to the source code of this file.

Functions

stringbin_poly_to_ascii (const fmpz_poly_t poly, const ntru_params *params)
stringbin_poly_arr_to_ascii (const fmpz_poly_t **bin_poly_arr, const uint32_t poly_c, const ntru_params *params)
stringpoly_to_ascii (const fmpz_poly_t poly, const ntru_params *params)
stringpoly_arr_to_ascii (const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params)
stringpoly_to_base64 (const fmpz_poly_t poly, const ntru_params *params)
stringpoly_arr_to_base64 (const fmpz_poly_t **poly_arr, const uint32_t poly_c, const ntru_params *params)

Detailed Description

header for ntru_poly_ascii.c

Header for the internal API of ntru_poly_ascii.c.

Definition in file ntru_poly_ascii.h.


Function Documentation

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.

Parameters:
bin_poly_arrthe array of polynomials
poly_cthe amount of polynomials in bin_poly_arr
paramsthe NTRU parameters
Returns:
the real string, newly allocated

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.

Parameters:
polythe binary polynomial to convert
paramsthe NTRU parameters
Returns:
the real string, newly allocated

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.

Parameters:
poly_arraythe array of polynomials
poly_cthe amount of polynomials in poly_arr
paramsthe NTRU parameters
Returns:
the real string, newly allocated

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.

Parameters:
poly_arrthe array of polynomials
poly_cthe amount of polynomials in poly_arr
paramsthe NTRU parameters
Returns:
the real string, newly allocated

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.

Parameters:
polythe polynomial to convert
paramsthe NTRU parameters
Returns:
the real string, newly allocated

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.

Parameters:
polythe polynomial to convert
paramsthe NTRU parameters
Returns:
the real string, newly allocated

Definition at line 237 of file ntru_poly_ascii.c.

 All Data Structures Files Functions Variables Typedefs Defines