|
post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
|
NTRU encryption. More...
#include "ntru_ascii_poly.h"#include "ntru_encrypt.h"#include "ntru_mem.h"#include "ntru_params.h"#include "ntru_poly.h"#include "ntru_poly_ascii.h"#include "ntru_string.h"#include <string.h>#include <fmpz_poly.h>#include <fmpz.h>
Go to the source code of this file.
Functions | |
| void | ntru_encrypt_poly (const fmpz_poly_t msg_bin, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, fmpz_poly_t out, const ntru_params *params) |
| string * | ntru_encrypt_string (const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params) |
NTRU encryption.
This file handles the NTRU encryption algorithm.
Definition in file ntru_encrypt.c.
| void ntru_encrypt_poly | ( | const fmpz_poly_t | msg_tern, |
| const fmpz_poly_t | pub_key, | ||
| const fmpz_poly_t | rnd, | ||
| fmpz_poly_t | out, | ||
| const ntru_params * | params | ||
| ) |
encrypt the msg, using the math: e = (h ∗ r) + m (mod q)
e = the encrypted poly
h = the public key
r = the random poly
m = the message poly
q = large mod
| msg_tern | the message to encrypt, in ternary format |
| pub_key | the public key |
| rnd | the random poly (should have relatively small coefficients, but not restricted to {-1, 0, 1}) |
| out | the output poly which is in the range {0, q-1} (not ternary!) [out] |
| params | ntru_params the ntru context |
Definition at line 46 of file ntru_encrypt.c.
| string* ntru_encrypt_string | ( | const string * | msg, |
| const fmpz_poly_t | pub_key, | ||
| const fmpz_poly_t | rnd, | ||
| const ntru_params * | params | ||
| ) |
Encrypt a message in the form of a null-terminated char array and return a string.
| msg | the message |
| pub_key | the public key |
| rnd | the random poly (should have relatively small coefficients, but not restricted to {-1, 0, 1}) |
| params | ntru_params the ntru context |
Definition at line 74 of file ntru_encrypt.c.
1.8.7