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

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>
Include dependency graph for ntru_ascii_poly.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)

Detailed Description

header for ntru_ascii_poly.c

Header for the internal API of ntru_ascii_poly.c.

Definition in file ntru_ascii_poly.h.


Function Documentation

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().

Parameters:
to_polythe string to get into binary polynomial format
paramsthe NTRUEncrypt context
Returns:
newly allocated array of binary polynomials

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().

Parameters:
to_polythe string to get into binary polynomial format
paramsthe NTRUEncrypt context
Returns:
newly allocated array of binary polynomials

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().

Parameters:
to_polythe 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)
paramsthe NTRUEncrypt context
Returns:
newly allocated array of polynomials

Definition at line 146 of file ntru_ascii_poly.c.

 All Data Structures Files Functions Variables Typedefs Defines