Wire Sysio Wire Sysion 1.0.0
|
#include <fp.hpp>
Public Member Functions | |
Fp_model () | |
Fp_model (const bigint< n > &b) | |
Fp_model (const long x, const bool is_unsigned=false) | |
void | set_ulong (const unsigned long x) |
void | mul_reduce (const bigint< n > &other) |
void | clear () |
bigint< n > | as_bigint () const |
unsigned long | as_ulong () const |
bool | operator== (const Fp_model &other) const |
bool | operator!= (const Fp_model &other) const |
bool | is_zero () const |
void | print () const |
Fp_model & | operator+= (const Fp_model &other) |
Fp_model & | operator-= (const Fp_model &other) |
Fp_model & | operator*= (const Fp_model &other) |
Fp_model & | operator^= (const unsigned long pow) |
template<mp_size_t m> | |
Fp_model & | operator^= (const bigint< m > &pow) |
Fp_model | operator+ (const Fp_model &other) const |
Fp_model | operator- (const Fp_model &other) const |
Fp_model | operator* (const Fp_model &other) const |
Fp_model | operator- () const |
Fp_model | squared () const |
Fp_model & | invert () |
Fp_model | inverse () const |
Fp_model | sqrt () const |
Fp_model | operator^ (const unsigned long pow) const |
template<mp_size_t m> | |
Fp_model | operator^ (const bigint< m > &pow) const |
Static Public Member Functions | |
static bool | modulus_is_valid () |
static size_t | size_in_bits () |
static size_t | capacity () |
static bigint< n > | field_char () |
static Fp_model< n, modulus > | zero () |
static Fp_model< n, modulus > | one () |
static Fp_model< n, modulus > | random_element () |
static Fp_model< n, modulus > | geometric_generator () |
static Fp_model< n, modulus > | arithmetic_generator () |
Public Attributes | |
bigint< n > | mont_repr |
Static Public Attributes | |
static const mp_size_t | num_limbs = n |
static const constexpr bigint< n > & | mod = modulus |
static size_t | num_bits |
static bigint< n > | euler |
static size_t | s |
static bigint< n > | t |
static bigint< n > | t_minus_1_over_2 |
static Fp_model< n, modulus > | nqr |
static Fp_model< n, modulus > | nqr_to_t |
static Fp_model< n, modulus > | multiplicative_generator |
static Fp_model< n, modulus > | root_of_unity |
static mp_limb_t | inv |
static bigint< n > | Rsquared |
static bigint< n > | Rcubed |
Friends | |
std::ostream & | operator (std::ostream &out, const Fp_model< n, modulus > &p) |
std::istream & | operator>> (std::istream &in, Fp_model< n, modulus > &p) |
Arithmetic in the finite field F[p], for prime p of fixed length.
This class implements Fp-arithmetic, for a large prime p, using a fixed number of words. It is optimized for tight memory consumption, so the modulus p is passed as a template parameter, to avoid per-element overheads.
The implementation is mostly a wrapper around GMP's MPN (constant-size integers). But for the integer sizes of interest for libff (3 to 5 limbs of 64 bits each), we implement performance-critical routines, like addition and multiplication, using hand-optimzied assembly code.
|
inline |
libff::Fp_model< n, modulus >::Fp_model | ( | const bigint< n > & | b | ) |
libff::Fp_model< n, modulus >::Fp_model | ( | const long | x, |
const bool | is_unsigned = false ) |
|
static |
bigint< n > libff::Fp_model< n, modulus >::as_bigint | ( | ) | const |
unsigned long libff::Fp_model< n, modulus >::as_ulong | ( | ) | const |
|
inlinestatic |
void libff::Fp_model< n, modulus >::clear | ( | ) |
|
inlinestatic |
|
static |
Fp_model libff::Fp_model< n, modulus >::inverse | ( | ) | const |
Fp_model & libff::Fp_model< n, modulus >::invert | ( | ) |
bool libff::Fp_model< n, modulus >::is_zero | ( | ) | const |
|
inlinestatic |
void libff::Fp_model< n, modulus >::mul_reduce | ( | const bigint< n > & | other | ) |
|
static |
bool libff::Fp_model< n, modulus >::operator!= | ( | const Fp_model< n, modulus > & | other | ) | const |
Fp_model libff::Fp_model< n, modulus >::operator* | ( | const Fp_model< n, modulus > & | other | ) | const |
Fp_model & libff::Fp_model< n, modulus >::operator*= | ( | const Fp_model< n, modulus > & | other | ) |
Fp_model libff::Fp_model< n, modulus >::operator+ | ( | const Fp_model< n, modulus > & | other | ) | const |
Fp_model & libff::Fp_model< n, modulus >::operator+= | ( | const Fp_model< n, modulus > & | other | ) |
Fp_model libff::Fp_model< n, modulus >::operator- | ( | ) | const |
Fp_model libff::Fp_model< n, modulus >::operator- | ( | const Fp_model< n, modulus > & | other | ) | const |
Fp_model & libff::Fp_model< n, modulus >::operator-= | ( | const Fp_model< n, modulus > & | other | ) |
bool libff::Fp_model< n, modulus >::operator== | ( | const Fp_model< n, modulus > & | other | ) | const |
Fp_model libff::Fp_model< n, modulus >::operator^ | ( | const bigint< m > & | pow | ) | const |
Fp_model libff::Fp_model< n, modulus >::operator^ | ( | const unsigned long | pow | ) | const |
Fp_model & libff::Fp_model< n, modulus >::operator^= | ( | const bigint< m > & | pow | ) |
Fp_model & libff::Fp_model< n, modulus >::operator^= | ( | const unsigned long | pow | ) |
void libff::Fp_model< n, modulus >::print | ( | ) | const |
|
static |
void libff::Fp_model< n, modulus >::set_ulong | ( | const unsigned long | x | ) |
|
inlinestatic |
Fp_model libff::Fp_model< n, modulus >::sqrt | ( | ) | const |
Fp_model libff::Fp_model< n, modulus >::squared | ( | ) | const |
|
static |
|
friend |
|
friend |
|
static |
|
static |
|
staticconstexpr |
bigint<n> libff::Fp_model< n, modulus >::mont_repr |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |