Trait pairing_ce::PrimeFieldRepr[][src]

pub trait PrimeFieldRepr: 'static + Copy + Clone + Eq + Ord + Send + Sync + Default + Debug + Display + Rand + AsRef<[u64]> + AsMut<[u64]> + From<u64> + Hash {
Show methods fn sub_noborrow(&mut self, other: &Self);
fn add_nocarry(&mut self, other: &Self);
fn num_bits(&self) -> u32;
fn is_zero(&self) -> bool;
fn is_odd(&self) -> bool;
fn is_even(&self) -> bool;
fn div2(&mut self);
fn shr(&mut self, amt: u32);
fn mul2(&mut self);
fn shl(&mut self, amt: u32); fn write_be<W>(&self, writer: W) -> Result<(), Error>
    where
        W: Write
, { ... }
fn read_be<R>(&mut self, reader: R) -> Result<(), Error>
    where
        R: Read
, { ... }
fn write_le<W>(&self, writer: W) -> Result<(), Error>
    where
        W: Write
, { ... }
fn read_le<R>(&mut self, reader: R) -> Result<(), Error>
    where
        R: Read
, { ... }
}

This trait represents a wrapper around a biginteger which can encode any element of a particular prime field. It is a smart wrapper around a sequence of u64 limbs, least-significant digit first.

Required methods

fn sub_noborrow(&mut self, other: &Self)[src]

Subtract another represetation from this one.

fn add_nocarry(&mut self, other: &Self)[src]

Add another representation to this one.

fn num_bits(&self) -> u32[src]

Compute the number of bits needed to encode this number. Always a multiple of 64.

fn is_zero(&self) -> bool[src]

Returns true iff this number is zero.

fn is_odd(&self) -> bool[src]

Returns true iff this number is odd.

fn is_even(&self) -> bool[src]

Returns true iff this number is even.

fn div2(&mut self)[src]

Performs a rightwise bitshift of this number, effectively dividing it by 2.

fn shr(&mut self, amt: u32)[src]

Performs a rightwise bitshift of this number by some amount.

fn mul2(&mut self)[src]

Performs a leftwise bitshift of this number, effectively multiplying it by 2. Overflow is ignored.

fn shl(&mut self, amt: u32)[src]

Performs a leftwise bitshift of this number by some amount.

Loading content...

Provided methods

fn write_be<W>(&self, writer: W) -> Result<(), Error> where
    W: Write
[src]

Writes this PrimeFieldRepr as a big endian integer.

fn read_be<R>(&mut self, reader: R) -> Result<(), Error> where
    R: Read
[src]

Reads a big endian integer into this representation.

fn write_le<W>(&self, writer: W) -> Result<(), Error> where
    W: Write
[src]

Writes this PrimeFieldRepr as a little endian integer.

fn read_le<R>(&mut self, reader: R) -> Result<(), Error> where
    R: Read
[src]

Reads a little endian integer into this representation.

Loading content...

Implementors

impl PrimeFieldRepr for pairing_ce::bls12_381::FqRepr[src]

fn is_odd(&self) -> bool[src]

fn is_even(&self) -> bool[src]

fn is_zero(&self) -> bool[src]

fn shr(&mut self, n: u32)[src]

fn div2(&mut self)[src]

fn mul2(&mut self)[src]

fn shl(&mut self, n: u32)[src]

fn num_bits(&self) -> u32[src]

fn add_nocarry(&mut self, other: &FqRepr)[src]

fn sub_noborrow(&mut self, other: &FqRepr)[src]

impl PrimeFieldRepr for pairing_ce::bls12_381::FrRepr[src]

fn is_odd(&self) -> bool[src]

fn is_even(&self) -> bool[src]

fn is_zero(&self) -> bool[src]

fn shr(&mut self, n: u32)[src]

fn div2(&mut self)[src]

fn mul2(&mut self)[src]

fn shl(&mut self, n: u32)[src]

fn num_bits(&self) -> u32[src]

fn add_nocarry(&mut self, other: &FrRepr)[src]

fn sub_noborrow(&mut self, other: &FrRepr)[src]

impl PrimeFieldRepr for pairing_ce::bn256::FqRepr[src]

fn is_odd(&self) -> bool[src]

fn is_even(&self) -> bool[src]

fn is_zero(&self) -> bool[src]

fn shr(&mut self, n: u32)[src]

fn div2(&mut self)[src]

fn mul2(&mut self)[src]

fn shl(&mut self, n: u32)[src]

fn num_bits(&self) -> u32[src]

fn add_nocarry(&mut self, other: &FqRepr)[src]

fn sub_noborrow(&mut self, other: &FqRepr)[src]

impl PrimeFieldRepr for pairing_ce::bn256::FrRepr[src]

fn is_odd(&self) -> bool[src]

fn is_even(&self) -> bool[src]

fn is_zero(&self) -> bool[src]

fn shr(&mut self, n: u32)[src]

fn div2(&mut self)[src]

fn mul2(&mut self)[src]

fn shl(&mut self, n: u32)[src]

fn num_bits(&self) -> u32[src]

fn add_nocarry(&mut self, other: &FrRepr)[src]

fn sub_noborrow(&mut self, other: &FrRepr)[src]

impl PrimeFieldRepr for pairing_ce::compact_bn256::FqRepr[src]

fn is_odd(&self) -> bool[src]

fn is_even(&self) -> bool[src]

fn is_zero(&self) -> bool[src]

fn shr(&mut self, n: u32)[src]

fn div2(&mut self)[src]

fn mul2(&mut self)[src]

fn shl(&mut self, n: u32)[src]

fn num_bits(&self) -> u32[src]

fn add_nocarry(&mut self, other: &FqRepr)[src]

fn sub_noborrow(&mut self, other: &FqRepr)[src]

impl PrimeFieldRepr for pairing_ce::compact_bn256::FrRepr[src]

fn is_odd(&self) -> bool[src]

fn is_even(&self) -> bool[src]

fn is_zero(&self) -> bool[src]

fn shr(&mut self, n: u32)[src]

fn div2(&mut self)[src]

fn mul2(&mut self)[src]

fn shl(&mut self, n: u32)[src]

fn num_bits(&self) -> u32[src]

fn add_nocarry(&mut self, other: &FrRepr)[src]

fn sub_noborrow(&mut self, other: &FrRepr)[src]

Loading content...