Modular (polynomial) arithmetic in ring . More...
#include "c4e_poly.h"
Go to the source code of this file.
Functions | |
void | c4e_mod2n_sqr (C4E_CONST C4eElement *C4E_RESTRICT a, C4E_CONST C4eElement *C4E_RESTRICT m, C4eElement *C4E_RESTRICT c) |
Square of a binary polynomial (having coefficients from ), with modular reduction. | |
void | c4e_mod2n_pow (C4E_CONST C4eElement *C4E_RESTRICT a, C4E_CONST C4eElement *C4E_RESTRICT n, C4E_CONST C4eElement *C4E_RESTRICT m, C4eElement *C4E_RESTRICT tmp, C4eElement *c) |
Modulo-power of a binary polynomial (with coefficients in ). |
Modular (polynomial) arithmetic in ring .
Definition in file c4e_mod2n.h.
void c4e_mod2n_sqr | ( | C4E_CONST C4eElement *C4E_RESTRICT | a, | |
C4E_CONST C4eElement *C4E_RESTRICT | m, | |||
C4eElement *C4E_RESTRICT | c | |||
) |
Square of a binary polynomial (having coefficients from ), with modular reduction.
a->size
^ 2).a
MUST be less/equal m->size
, but not to be normalized (except for performance reasons). c->digits
must point to pre-allocated memory space for at least m->size
digits. a
with c
or aliasing a->digits
with c->digits
is not allowed.[in] | a | Polynomial to be squared. |
[in] | m | Modulus (binary polynomial), unequal to zero. |
[out] | c | Result , not normalized. |
void c4e_mod2n_pow | ( | C4E_CONST C4eElement *C4E_RESTRICT | a, | |
C4E_CONST C4eElement *C4E_RESTRICT | n, | |||
C4E_CONST C4eElement *C4E_RESTRICT | m, | |||
C4eElement *C4E_RESTRICT | tmp, | |||
C4eElement * | c | |||
) |
Modulo-power of a binary polynomial (with coefficients in ).
The algebraic operation performed by this left-to-right algorithm is a (modular) exponentiation in finite field . It is based on the binary representation of exponent , which results in:
a
and n
should be normalized, because of performance reasons. a
should be reduced to m
on function entry, for example using c4e_poly_mod(a_in, NULL, m, a_out).a(x)
and n
are zero. The caller has to ensure this, may be using macro C4E_ELEM_IS_ZERO(). c->digits
and tmp->digits
must point to pre-allocated memory space for at least m->size
digits. m
must be normalized, for example using function c4e_elem_norm(). [in] | a | Argument (binary polynomial). |
[in] | n | Big number exponent. |
[in] | m | Modulus (binary polynomial), unequal to zero. |
tmp | Temporary space needed for intermediate results. | |
[out] | c | Result , not normalized. |