MPHELL
5.0.0
|
Definition of Adapted Modular Number System (AMNS) functions. More...
#include "mphell-amns.h"
Go to the source code of this file.
Macros | |
#define | PRAGMA_UNROLL |
#define | TEMPLATE_amns_elt_add_declare(sl) void amns_elt_add##sl (amns_elt_ptr dst, amns_elt_srcptr a, amns_elt_srcptr b, amns_srcptr AMNS); \ |
#define | TEMPLATE_amns_elt_sub_declare(sl) void amns_elt_sub##sl (amns_elt_ptr dst, amns_elt_srcptr a, amns_elt_srcptr b, amns_srcptr AMNS); \ |
#define | TEMPLATE_amns_elt_neg_declare(sl) void amns_elt_neg##sl (amns_elt_ptr dst, amns_elt_srcptr a, amns_srcptr AMNS); \ |
#define | TEMPLATE_amns_elt_mul_declare(sl) void amns_elt_mul##sl (amns_elt_ptr dst, amns_elt_srcptr a, amns_elt_srcptr b, amns_srcptr AMNS); \ |
#define | TEMPLATE_amns_elt_mul_shift_p_declare(sl) void amns_elt_mul_shift_p##sl (amns_elt_ptr dst, amns_elt_srcptr a, amns_elt_srcptr b, amns_srcptr AMNS); \ |
#define | TEMPLATE_amns_elt_mul_shift_n_declare(sl) void amns_elt_mul_shift_n##sl (amns_elt_ptr dst, amns_elt_srcptr a, amns_elt_srcptr b, amns_srcptr AMNS); \ |
#define | TEMPLATE_amns_elt_sqr_declare(sl) void amns_elt_sqr##sl (amns_elt_ptr dst, amns_elt_srcptr a, amns_srcptr AMNS); \ |
#define | TEMPLATE_amns_elt_sqr_shift_p_declare(sl) void amns_elt_sqr_shift_p##sl (amns_elt_ptr dst, amns_elt_srcptr a, amns_srcptr AMNS); \ |
#define | TEMPLATE_amns_elt_sqr_shift_n_declare(sl) void amns_elt_sqr_shift_n##sl (amns_elt_ptr dst, amns_elt_srcptr a, amns_srcptr AMNS); \ |
#define | TEMPLATE_amns_internal_red_declare(sl) void amns_internal_red##sl(amns_elt_ptr S, amns_llong * V, amns_srcptr AMNS); \ |
#define | TEMPLATE_amns_elt_is_reduced_declare(sl) static inline bool amns_elt_is_reduced##sl (amns_elt_srcptr a, amns_srcptr AMNS); \ |
#define | TEMPLATE_amns_internal_red(sl) |
#define | TEMPLATE_amns_elt_is_reduced(sl) |
#define | TEMPLATE_amns_elt_add(sl) |
#define | TEMPLATE_amns_elt_neg(sl) |
#define | TEMPLATE_amns_elt_sub(sl) |
#define | TEMPLATE_amns_elt_mul(sl) |
#define | TEMPLATE_amns_elt_mul_shift_p(sl) |
#define | TEMPLATE_amns_elt_mul_shift_n(sl) |
#define | TEMPLATE_amns_elt_sqr(sl) |
#define | TEMPLATE_amns_elt_sqr_shift_p(sl) |
#define | TEMPLATE_amns_elt_sqr_shift_n(sl) |
Functions | |
TEMPLATE_amns_elt_add_declare (2) | |
void | amns_free (amns_ptr *AMNS) |
Free the amns system. More... | |
void | amns_elt_alloc (amns_elt *dst, amns_srcptr AMNS) |
Allocate the amns (polynomial of degree less than n) element according to the degree of E. More... | |
void | amns_elt_free (amns_elt *dst) |
Free the amns element. More... | |
void | amns_print_bloc (amns_block b) |
Print b. More... | |
void | amns_print_bloc_ul (amns_ulong b) |
Print an amns ulong (uint64_t or uint32_t) More... | |
void | amns_print_elt_raw (const amns_block *x, uint8_t size) |
Print the AMNS element x. More... | |
void | amns_print_elt_raw_ul (const amns_ulong *x, uint8_t size) |
Print an amns ulong vector. More... | |
void | amns_print_elt (amns_elt_srcptr x, amns_srcptr AMNS) |
Print the AMNS element x. More... | |
void | amns_print_elt_ul (const amns_ulong *x, amns_srcptr AMNS) |
Print an amns ulong vector. More... | |
void | amns_print_AMNS (amns_srcptr AMNS) |
Print the AMNS system. More... | |
void | amns_print_stat (amns_srcptr AMNS) |
Print the AMNS system statistic. More... | |
uint8_t | amns_calculate_max_coeff_size (amns_elt_srcptr a, amns_srcptr AMNS) |
Calculate log2(||a||_infty) More... | |
amns_block | amns_calculate_max_coeff (amns_elt_srcptr a, amns_srcptr AMNS) |
Calculate (||a||_infty) More... | |
void | amns_internal_red_generic (amns_elt_ptr S, amns_llong *V, amns_srcptr AMNS) |
Internal reduction using Montgomery method, not optimised because the compiler cannot guess the loop size. More... | |
void | amns_internal_red (amns_elt_ptr S, amns_llong *V, amns_srcptr AMNS) |
Internal reduction using Montgomery method, optimised with templates to allow the compiler to guess the loop size. More... | |
TEMPLATE_amns_internal_red (2) | |
void | set_fast_internal_reduction_nist521 (amns_ptr AMNS) |
Set up a dedicated AMNS internal reduction for NIST 521 (Mersenne prime), the AMNS must be exactly the one defined in mphell-curve.c. More... | |
void | amns_internal_red_exact (amns_elt_ptr dst, amns_srcptr AMNS) |
Set dst such that dst(gamma) == R(gamma) et |coeffs(dst)| < 2^rho, use after addition when the coefficients become greater than max_digit_delta. More... | |
void | amns_calcule_Ti (amns_ptr AMNS, const amns_block *P0, const amns_block *P1) |
Compute the polynomials (amns elements) Ti such that Ti(gamma) = 2^(rho.i) * phi^2. Used for binary to AMNS conversion. More... | |
void | amns_calcule_gi (amns_ptr AMNS) |
Compute the number gi such that gi = gamma^i mod p. Used for AMNS to binary conversion. More... | |
void | amns_calcule_Mi (amns_ptr AMNS, const amns_block *M) |
Compute the Mti used by the internal reduction. More... | |
void | amns_calcule_Miprime (amns_ptr AMNS, const amns_block *Mprime) |
Compute the Mtiprime used by the internal reduction. More... | |
static bool | amns_elt_is_reduced_generic (amns_elt_srcptr a, amns_srcptr AMNS) |
Test if the coefficient a_i of a are all such that |a_i|<2^rho. More... | |
TEMPLATE_amns_elt_is_reduced (2) | |
void | amns_elt_copy_ul_2_amns (amns_elt dst, const amns_ulong *a, amns_srcptr AMNS) |
Copy a unsigned vector into a signed vector modulo phi, the modulo is applied through the cast. More... | |
void | amns_elt_read_sep (amns_block *x, char *str) |
Parser to read a signed AMNS vector. More... | |
void | amns_elt_read_sep_ul (amns_ulong *x, char *str) |
Parser to read a unsigned AMNS vector. More... | |
void | amns_alloc_init_str (amns_ptr *AMNS, char *str, number p) |
Allocate and initialise the amns system from the string generated by the Sage AMNS generator from https://github.com/arithPMNS/generalisation_amns. More... | |
uint8_t | previous_power_2 (uint8_t x) |
Round to the previous power of 2. More... | |
void | amns_init (amns_ptr AMNS, const amns_block *E, const amns_block *P0, const amns_block *P1, const amns_block *M, const amns_ulong *Mprime, number_srcptr p, number gamma, uint8_t rho, uint8_t nb_add_max) |
Initialise the amns system. More... | |
void | amns_init_stat (amns_ptr AMNS) |
Initialise again the AMNS statistics. More... | |
void | amns_elt_write (amns_block *x, uint8_t size, char *str) |
Write a amns element into a string. More... | |
void | amns_elt_read (amns_block *x, char *str) |
Read a AMNS element from a string. More... | |
void | amns_elt_read_ul (amns_ulong *x, char *str) |
Read a ulong polynomial from a string. More... | |
void | amns_elt_set_zero (amns_elt_ptr dst, amns_srcptr AMNS) |
Set dst to 0. More... | |
void | amns_mul_scalar_llong (amns_llong *dst, amns_elt_srcptr a, amns_ulong b, amns_srcptr AMNS) |
Multiply the llong polynomial a by the scalar b. More... | |
void | amns_add_llong (amns_llong *dst, amns_llong *a, amns_llong *b, amns_srcptr AMNS) |
Add the llong polynomials a and b. More... | |
void | binary_to_amns (number_srcptr a, amns_elt_ptr dst, amns_srcptr AMNS) |
Convert a number into its AMNS representation. More... | |
void | binary_ui_to_amns (block a, amns_elt_ptr dst, amns_srcptr AMNS) |
Convert a small number into its AMNS representation. More... | |
void | amns_to_binary (const amns_elt_srcptr a, number_ptr dst, amns_srcptr AMNS) |
Convert AMNS representation into a number. More... | |
bool | amns_elt_is_zero (amns_elt_srcptr src, amns_srcptr AMNS) |
Test if src is zero. More... | |
bool | amns_elt_isequal (amns_elt_srcptr src1, amns_elt_srcptr src2, amns_srcptr AMNS) |
Test if src1 == src2, if true OK, if false, must be tested on binary !!! More... | |
int8_t | amns_elt_cmp (amns_elt_srcptr src1, amns_elt_srcptr src2, amns_srcptr AMNS) |
Compare src1 and src2. More... | |
int8_t | amns_elt_cmp_ui (amns_elt_srcptr src1, block src2, amns_srcptr AMNS) |
Compare src1 and src2. More... | |
void | amns_elt_copy (amns_elt_ptr dst, amns_elt_srcptr a, amns_srcptr AMNS) |
Copy a into dst. More... | |
void | amns_elt_add_generic (amns_elt_ptr dst, amns_elt_srcptr a, amns_elt_srcptr b, amns_srcptr AMNS) |
Set dst to a + b, using a generic code not optimised. More... | |
void | amns_elt_add (amns_elt_ptr dst, amns_elt_srcptr a, amns_elt_srcptr b, amns_srcptr AMNS) |
Set dst to a + b. More... | |
void | amns_elt_neg (amns_elt_ptr dst, amns_elt_srcptr a, amns_srcptr AMNS) |
Set dst to -a. More... | |
void | amns_elt_sub (amns_elt_ptr dst, amns_elt_srcptr a, amns_elt_srcptr b, amns_srcptr AMNS) |
Set dst to a - b. More... | |
TEMPLATE_amns_elt_mul (2) | |
void | amns_elt_sqr_generic (amns_elt_ptr dst, amns_elt_srcptr a, amns_srcptr AMNS) |
Set dst to a^2, using a generic code not optimised. More... | |
TEMPLATE_amns_elt_sqr (2) | |
Definition of Adapted Modular Number System (AMNS) functions.
Definition in file mphell-amns.c.
#define TEMPLATE_amns_elt_add | ( | sl | ) |
Definition at line 2359 of file mphell-amns.c.
#define TEMPLATE_amns_elt_is_reduced | ( | sl | ) |
Definition at line 1127 of file mphell-amns.c.
#define TEMPLATE_amns_elt_neg | ( | sl | ) |
Definition at line 2432 of file mphell-amns.c.
#define TEMPLATE_amns_elt_sub | ( | sl | ) |
Definition at line 2512 of file mphell-amns.c.
void amns_add_llong | ( | amns_llong * | dst, |
amns_llong * | a, | ||
amns_llong * | b, | ||
amns_srcptr | AMNS | ||
) |
Add the llong polynomials a and b.
dst | Destination polynomial |
a | Source polynomial |
b | Source polynomial |
AMNS | AMNS system |
Definition at line 2143 of file mphell-amns.c.
void amns_alloc_init_str | ( | amns_ptr * | AMNS, |
char * | str, | ||
number | p | ||
) |
Allocate and initialise the amns system from the string generated by the Sage AMNS generator from https://github.com/arithPMNS/generalisation_amns.
AMNS | AMNS to initialise |
str | String generated by the sage AMNS generator |
p | Prime number |
Definition at line 1242 of file mphell-amns.c.
amns_block amns_calculate_max_coeff | ( | amns_elt_srcptr | a, |
amns_srcptr | AMNS | ||
) |
Calculate (||a||_infty)
Source | amns element |
AMNS | AMNS system |
Definition at line 671 of file mphell-amns.c.
uint8_t amns_calculate_max_coeff_size | ( | amns_elt_srcptr | a, |
amns_srcptr | AMNS | ||
) |
Calculate log2(||a||_infty)
Source | amns element |
AMNS | AMNS system |
Definition at line 645 of file mphell-amns.c.
void amns_calcule_gi | ( | amns_ptr | AMNS | ) |
Compute the number gi such that gi = gamma^i mod p. Used for AMNS to binary conversion.
AMNS | AMNS system |
Definition at line 1020 of file mphell-amns.c.
void amns_calcule_Mi | ( | amns_ptr | AMNS, |
const amns_block * | M | ||
) |
Compute the Mti used by the internal reduction.
M | Internal reduction polynomial |
AMNS | AMNS system |
Definition at line 1040 of file mphell-amns.c.
void amns_calcule_Miprime | ( | amns_ptr | AMNS, |
const amns_block * | Mprime | ||
) |
Compute the Mtiprime used by the internal reduction.
Mprime | -M^(-1) mod(E, phi) |
AMNS | AMNS system |
Definition at line 1075 of file mphell-amns.c.
void amns_calcule_Ti | ( | amns_ptr | AMNS, |
const amns_block * | P0, | ||
const amns_block * | P1 | ||
) |
Compute the polynomials (amns elements) Ti such that Ti(gamma) = 2^(rho.i) * phi^2. Used for binary to AMNS conversion.
P0 | AMNS representation of phi^2 |
P1 | AMNS representation of rho * phi^2 |
AMNS | AMNS system |
Definition at line 983 of file mphell-amns.c.
void amns_elt_add | ( | amns_elt_ptr | dst, |
amns_elt_srcptr | a, | ||
amns_elt_srcptr | b, | ||
amns_srcptr | AMNS | ||
) |
Set dst to a + b.
dst | AMNS representation of a + b |
a | Source AMNS element |
b | Source AMNS element |
AMNS | AMNS system |
Definition at line 2354 of file mphell-amns.c.
void amns_elt_add_generic | ( | amns_elt_ptr | dst, |
amns_elt_srcptr | a, | ||
amns_elt_srcptr | b, | ||
amns_srcptr | AMNS | ||
) |
Set dst to a + b, using a generic code not optimised.
dst | AMNS representation of a + b |
a | Source AMNS element |
b | Source AMNS element |
AMNS | AMNS system |
Definition at line 2329 of file mphell-amns.c.
void amns_elt_alloc | ( | amns_elt * | dst, |
amns_srcptr | AMNS | ||
) |
Allocate the amns (polynomial of degree less than n) element according to the degree of E.
dst | AMNS element to allocate |
AMNS | AMNS system |
Definition at line 496 of file mphell-amns.c.
int8_t amns_elt_cmp | ( | amns_elt_srcptr | src1, |
amns_elt_srcptr | src2, | ||
amns_srcptr | AMNS | ||
) |
Compare src1 and src2.
src1 | AMNS representation of a integer |
src2 | AMNS representation of a integer |
AMNS | AMNS system |
Definition at line 2284 of file mphell-amns.c.
int8_t amns_elt_cmp_ui | ( | amns_elt_srcptr | src1, |
block | src2, | ||
amns_srcptr | AMNS | ||
) |
Compare src1 and src2.
src1 | AMNS representation of a integer |
src2 | Unsigned integer |
AMNS | AMNS system |
Definition at line 2297 of file mphell-amns.c.
void amns_elt_copy | ( | amns_elt_ptr | dst, |
amns_elt_srcptr | a, | ||
amns_srcptr | AMNS | ||
) |
Copy a into dst.
dst | Destination AMNS element |
a | Source AMNS element |
AMNS | AMNS system |
Definition at line 2310 of file mphell-amns.c.
void amns_elt_copy_ul_2_amns | ( | amns_elt | dst, |
const amns_ulong * | a, | ||
amns_srcptr | AMNS | ||
) |
Copy a unsigned vector into a signed vector modulo phi, the modulo is applied through the cast.
dst | AMNS signed vector |
a | Unsigned vector |
AMNS | AMNS system |
Definition at line 1183 of file mphell-amns.c.
void amns_elt_free | ( | amns_elt * | dst | ) |
Free the amns element.
dst | AMNS element to free |
Definition at line 501 of file mphell-amns.c.
|
inlinestatic |
Test if the coefficient a_i of a are all such that |a_i|<2^rho.
a | AMNS element to test |
AMNS | AMNS system |
Definition at line 1112 of file mphell-amns.c.
bool amns_elt_is_zero | ( | amns_elt_srcptr | src, |
amns_srcptr | AMNS | ||
) |
Test if src is zero.
src | AMNS representation of a integer |
AMNS | AMNS system |
Definition at line 2261 of file mphell-amns.c.
bool amns_elt_isequal | ( | amns_elt_srcptr | src1, |
amns_elt_srcptr | src2, | ||
amns_srcptr | AMNS | ||
) |
Test if src1 == src2, if true OK, if false, must be tested on binary !!!
src1 | AMNS representation of a integer |
src2 | AMNS representation of a integer |
AMNS | AMNS system (bases, ...) |
Definition at line 2271 of file mphell-amns.c.
void amns_elt_neg | ( | amns_elt_ptr | dst, |
amns_elt_srcptr | a, | ||
amns_srcptr | AMNS | ||
) |
Set dst to -a.
dst | AMNS representation of -a |
a | Source AMNS element |
AMNS | AMNS system |
Definition at line 2427 of file mphell-amns.c.
void amns_elt_read | ( | amns_block * | x, |
char * | str | ||
) |
Read a AMNS element from a string.
x | Destination AMNS element |
str | Source string to read |
Definition at line 2069 of file mphell-amns.c.
void amns_elt_read_sep | ( | amns_block * | x, |
char * | str | ||
) |
Parser to read a signed AMNS vector.
x | Destination AMNS vector |
str | String to parse |
Definition at line 1202 of file mphell-amns.c.
void amns_elt_read_sep_ul | ( | amns_ulong * | x, |
char * | str | ||
) |
Parser to read a unsigned AMNS vector.
x | Destination unsigned vector |
str | String to parse |
Definition at line 1227 of file mphell-amns.c.
void amns_elt_read_ul | ( | amns_ulong * | x, |
char * | str | ||
) |
Read a ulong polynomial from a string.
x | Destination polynomial |
str | Source string to read |
Definition at line 2088 of file mphell-amns.c.
void amns_elt_set_zero | ( | amns_elt_ptr | dst, |
amns_srcptr | AMNS | ||
) |
Set dst to 0.
dst | AMNS element |
AMNS | AMNS system |
Definition at line 2103 of file mphell-amns.c.
void amns_elt_sqr_generic | ( | amns_elt_ptr | dst, |
amns_elt_srcptr | a, | ||
amns_srcptr | AMNS | ||
) |
Set dst to a^2, using a generic code not optimised.
dst | AMNS representation of a^2 |
a | Source AMNS element |
AMNS | AMNS system |
Definition at line 2852 of file mphell-amns.c.
void amns_elt_sub | ( | amns_elt_ptr | dst, |
amns_elt_srcptr | a, | ||
amns_elt_srcptr | b, | ||
amns_srcptr | AMNS | ||
) |
Set dst to a - b.
dst | AMNS representation of a - b |
a | Source AMNS element |
b | Source AMNS element |
AMNS | AMNS system |
Definition at line 2507 of file mphell-amns.c.
void amns_elt_write | ( | amns_block * | x, |
uint8_t | size, | ||
char * | str | ||
) |
Write a amns element into a string.
x | AMNS element to write |
size | Size of x |
str | Destination string, must be large enough |
Definition at line 2053 of file mphell-amns.c.
void amns_free | ( | amns_ptr * | AMNS | ) |
Free the amns system.
AMNS | AMNS system to free |
Definition at line 444 of file mphell-amns.c.
void amns_init | ( | amns_ptr | AMNS, |
const amns_block * | E, | ||
const amns_block * | P0, | ||
const amns_block * | P1, | ||
const amns_block * | M, | ||
const amns_ulong * | Mprime, | ||
number_srcptr | p, | ||
number | gamma, | ||
uint8_t | rho, | ||
uint8_t | nb_add_max | ||
) |
Initialise the amns system.
AMNS | AMNS to initialise |
E | External reduction polynomial |
P0 | AMNS representation of phi^2 |
P1 | AMNS representation of rho * phi^2 |
M | Internal reduction polynomial |
Mprime | -M^(-1) mod(E, phi) |
p | Prime number |
gamma | Root of E mod p : E(gammma)=0 mod p |
rho | Reduced coefficient of the AMNS are < 2^rho |
nb_add_max | Maximum number of consecutive addition / substraction that can be done without to call a costly internal reduction. |
Definition at line 1324 of file mphell-amns.c.
void amns_init_stat | ( | amns_ptr | AMNS | ) |
Initialise again the AMNS statistics.
AMNS | AMNS in use |
Definition at line 2039 of file mphell-amns.c.
void amns_internal_red | ( | amns_elt_ptr | S, |
amns_llong * | V, | ||
amns_srcptr | AMNS | ||
) |
Internal reduction using Montgomery method, optimised with templates to allow the compiler to guess the loop size.
S | Resulting reduced vector |
V | Vector to reduce |
AMNS | system |
Definition at line 740 of file mphell-amns.c.
void amns_internal_red_exact | ( | amns_elt_ptr | dst, |
amns_srcptr | AMNS | ||
) |
Set dst such that dst(gamma) == R(gamma) et |coeffs(dst)| < 2^rho, use after addition when the coefficients become greater than max_digit_delta.
dst | Destination and source amns element |
AMNS | AMNS system |
Definition at line 951 of file mphell-amns.c.
void amns_internal_red_generic | ( | amns_elt_ptr | S, |
amns_llong * | V, | ||
amns_srcptr | AMNS | ||
) |
Internal reduction using Montgomery method, not optimised because the compiler cannot guess the loop size.
S | Resulting reduced vector |
V | Vector to reduce |
AMNS | system |
Definition at line 697 of file mphell-amns.c.
void amns_mul_scalar_llong | ( | amns_llong * | dst, |
amns_elt_srcptr | a, | ||
amns_ulong | b, | ||
amns_srcptr | AMNS | ||
) |
Multiply the llong polynomial a by the scalar b.
dst | Destination polynomial |
a | Source polynomial |
b | Scalar (integer) |
AMNS | AMNS system |
Definition at line 2124 of file mphell-amns.c.
void amns_print_AMNS | ( | amns_srcptr | AMNS | ) |
void amns_print_bloc | ( | amns_block | b | ) |
void amns_print_bloc_ul | ( | amns_ulong | b | ) |
Print an amns ulong (uint64_t or uint32_t)
b | Unsigned integer to print |
Definition at line 524 of file mphell-amns.c.
void amns_print_elt | ( | amns_elt_srcptr | x, |
amns_srcptr | AMNS | ||
) |
Print the AMNS element x.
x | AMNS representation of X |
AMNS | AMNS system (bases, ...) |
Definition at line 561 of file mphell-amns.c.
void amns_print_elt_raw | ( | const amns_block * | x, |
uint8_t | size | ||
) |
Print the AMNS element x.
x | AMNS representation of X |
size | Size of x (in number of amns_block element) |
Definition at line 533 of file mphell-amns.c.
void amns_print_elt_raw_ul | ( | const amns_ulong * | x, |
uint8_t | size | ||
) |
Print an amns ulong vector.
x | Unsigned integer vector to print |
size | Size of the vector |
Definition at line 550 of file mphell-amns.c.
void amns_print_elt_ul | ( | const amns_ulong * | x, |
amns_srcptr | AMNS | ||
) |
Print an amns ulong vector.
x | Unsigned integer vector to print |
AMNS | AMNS system |
Definition at line 572 of file mphell-amns.c.
void amns_print_stat | ( | amns_srcptr | AMNS | ) |
Print the AMNS system statistic.
AMNS | AMNS system |
Definition at line 622 of file mphell-amns.c.
void amns_to_binary | ( | const amns_elt_srcptr | a, |
number_ptr | dst, | ||
amns_srcptr | AMNS | ||
) |
Convert AMNS representation into a number.
a | AMNS representation of a |
dst | Destination number (binary representation of a) |
AMNS | AMNS system |
Definition at line 2223 of file mphell-amns.c.
void binary_to_amns | ( | number_srcptr | a, |
amns_elt_ptr | dst, | ||
amns_srcptr | AMNS | ||
) |
Convert a number into its AMNS representation.
a | Source number (binary representation) |
dst | AMNS representation of a |
AMNS | AMNS system |
Definition at line 2154 of file mphell-amns.c.
void binary_ui_to_amns | ( | block | a, |
amns_elt_ptr | dst, | ||
amns_srcptr | AMNS | ||
) |
Convert a small number into its AMNS representation.
a | Source number (binary representation) |
dst | AMNS representation of a |
AMNS | AMNS system |
Definition at line 2189 of file mphell-amns.c.
uint8_t previous_power_2 | ( | uint8_t | x | ) |
Round to the previous power of 2.
x | 8 bits unsigned integer to round |
Definition at line 1316 of file mphell-amns.c.
void set_fast_internal_reduction_nist521 | ( | amns_ptr | AMNS | ) |
Set up a dedicated AMNS internal reduction for NIST 521 (Mersenne prime), the AMNS must be exactly the one defined in mphell-curve.c.
AMNS | AMNS to modify |
Definition at line 935 of file mphell-amns.c.