Public Member Functions | |
CN_Residue () | |
void | init (const mpz_t M) |
CN_Residue (const mpz_t M) | |
~CN_Residue () | |
void | mod (mpz_t res, const mpz_t a) |
CN_Residue () | |
void | init (const mpz_t M) |
CN_Residue (const mpz_t M) | |
~CN_Residue () | |
void | redc (mpz_t res, const mpz_t T) |
reduce-operation | |
void | convert (mpz_t x) const |
convert to N-residue | |
void | convert_back (mpz_t x) const |
convert N-residue back to normal-form | |
int | invert (mpz_t res, const mpz_t T) const |
res = T^(-1) mod N (in N-residue) | |
Private Attributes | |
mpz_t | N |
mpz_t | R |
mpz_t | h |
unsigned int | k |
mpz_t | Ri |
mpz_t | Ns |
mpz_t | m |
mpz_t | t |
Definition at line 17 of file modular_arithmetic.cc.
CN_Residue::CN_Residue | ( | ) | [inline] |
Definition at line 25 of file modular_arithmetic.cc.
References cout, endl(), h, k, mpz_init(), N, and R.
Referenced by CN_Residue().
CN_Residue::CN_Residue | ( | const mpz_t | M | ) | [inline, explicit] |
Definition at line 38 of file modular_arithmetic.cc.
References CN_Residue(), and init().
CN_Residue::~CN_Residue | ( | ) | [inline] |
Definition at line 43 of file modular_arithmetic.cc.
References h, mpz_clear(), N, and R.
CN_Residue::CN_Residue | ( | ) | [inline] |
CN_Residue::CN_Residue | ( | const mpz_t | M | ) | [inline, explicit] |
Definition at line 51 of file modular_mult.cc.
References CN_Residue(), and init().
CN_Residue::~CN_Residue | ( | ) | [inline] |
Definition at line 56 of file modular_mult.cc.
References m, mpz_clear(), N, Ns, R, Ri, and t.
void CN_Residue::init | ( | const mpz_t | M | ) | [inline] |
Definition at line 31 of file modular_arithmetic.cc.
References h, k, mpz_cdiv_q(), mpz_mul_2exp(), mpz_set(), mpz_set_ui(), mpz_sizeinbase(), N, and R.
Referenced by CN_Residue().
void CN_Residue::mod | ( | mpz_t | res, | |
const mpz_t | a | |||
) | [inline] |
Definition at line 49 of file modular_arithmetic.cc.
References cerr, endl(), h, k, mpz_add_ui(), mpz_fdiv_q_2exp(), mpz_mod(), mpz_mul(), mpz_sizeinbase(), mpz_sub(), N, and R.
void CN_Residue::init | ( | const mpz_t | M | ) | [inline] |
Definition at line 42 of file modular_mult.cc.
References k, mpz_invert(), mpz_mod(), mpz_mul(), mpz_mul_2exp(), mpz_set(), mpz_set_ui(), mpz_sizeinbase(), mpz_sub_ui(), N, Ns, R, and Ri.
void CN_Residue::redc | ( | mpz_t | res, | |
const mpz_t | T | |||
) | [inline] |
reduce-operation
Definition at line 62 of file modular_mult.cc.
References k, m, mpz_add(), mpz_cmp(), mpz_mod(), mpz_mul(), mpz_sub(), mpz_tdiv_q_2exp(), mpz_tdiv_r_2exp(), N, Ns, and t.
void CN_Residue::convert | ( | mpz_t | x | ) | const [inline] |
convert to N-residue
Definition at line 83 of file modular_mult.cc.
References k, mpz_mod(), mpz_mul_2exp(), and N.
Referenced by invert().
void CN_Residue::convert_back | ( | mpz_t | x | ) | const [inline] |
int CN_Residue::invert | ( | mpz_t | res, | |
const mpz_t | T | |||
) | const [inline] |
res = T^(-1) mod N (in N-residue)
Definition at line 93 of file modular_mult.cc.
References convert(), convert_back(), mpz_invert(), mpz_set(), and N.
mpz_t CN_Residue::N [private] |
Definition at line 20 of file modular_arithmetic.cc.
Referenced by CN_Residue(), convert(), convert_back(), init(), invert(), mod(), redc(), and ~CN_Residue().
mpz_t CN_Residue::R [private] |
Definition at line 21 of file modular_arithmetic.cc.
Referenced by CN_Residue(), init(), mod(), and ~CN_Residue().
mpz_t CN_Residue::h [private] |
Definition at line 22 of file modular_arithmetic.cc.
Referenced by CN_Residue(), init(), mod(), and ~CN_Residue().
unsigned int CN_Residue::k [private] |
Definition at line 23 of file modular_arithmetic.cc.
Referenced by CN_Residue(), convert(), init(), mod(), and redc().
mpz_t CN_Residue::Ri [private] |
Definition at line 30 of file modular_mult.cc.
Referenced by CN_Residue(), convert_back(), init(), and ~CN_Residue().
mpz_t CN_Residue::Ns [private] |
Definition at line 30 of file modular_mult.cc.
Referenced by CN_Residue(), init(), redc(), and ~CN_Residue().
mpz_t CN_Residue::m [private] |
Definition at line 31 of file modular_mult.cc.
Referenced by CN_Residue(), redc(), and ~CN_Residue().
mpz_t CN_Residue::t [private] |
Definition at line 31 of file modular_mult.cc.
Referenced by CN_Residue(), redc(), and ~CN_Residue().