Trait blstrs::PrimeFieldRepr[][src]

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

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

Subtract another represetation from this one.

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

Add another representation to this one.

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

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

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

Returns true iff this number is zero.

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

Returns true iff this number is odd.

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

Returns true iff this number is even.

pub fn div2(&mut self)[src]

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

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

Performs a rightwise bitshift of this number by some amount.

pub fn mul2(&mut self)[src]

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

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

Performs a leftwise bitshift of this number by some amount.

Loading content...

Provided methods

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

Writes this PrimeFieldRepr as a big endian integer.

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

Reads a big endian integer into this representation.

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

Writes this PrimeFieldRepr as a little endian integer.

pub 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 FpRepr[src]

impl PrimeFieldRepr for ScalarRepr[src]

Loading content...