Binary

Struct Binary 

Source
pub struct Binary<R: EuclideanRing> { /* private fields */ }
Expand description

Binary field structure for the field GF(2^m) that contains the XOR ring and irreducible value.

See crate::gf::binary for the full example.

Implementations§

Source§

impl<R: EuclideanRing> Binary<R>

Source

pub fn new(ring: R, irreducible: R::Item) -> Self

Create a binary field object from the given XOR ring and the irreducible value.

Source

pub fn ring(&self) -> &R

Get ring.

Source

pub fn irreducible(&self) -> &R::Item

Get irreducible.

Trait Implementations§

Source§

impl<R: Clone + EuclideanRing> Clone for Binary<R>
where R::Item: Clone,

Source§

fn clone(&self) -> Binary<R>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<R: Debug + EuclideanRing> Debug for Binary<R>
where R::Item: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<R: EuclideanRing> Field for Binary<R>

Source§

type Item = <R as EuclideanRing>::Item

The type of the field elements.
Source§

fn zero(&self) -> Self::Item

Get the zero element of the field (the identity by addition).
Source§

fn one(&self) -> Self::Item

Get the one element of the field (the identity by multiplication).
Source§

fn eq(&self, a: &Self::Item, b: &Self::Item) -> bool

Perform the equity operation in the field.
Source§

fn add(&self, a: &Self::Item, b: &Self::Item) -> Self::Item

Perform addition operation in the field.
Source§

fn sub(&self, a: &Self::Item, b: &Self::Item) -> Self::Item

Perform sub operation. By default it is implemented through add and neg but it can be overridden for optimization purposes.
Source§

fn mul(&self, a: &Self::Item, b: &Self::Item) -> Self::Item

Perform multiplication operation in the field.
Source§

fn neg(&self, a: &Self::Item) -> Self::Item

Get inversed element by addition.
Source§

fn inv(&self, a: &Self::Item) -> Option<Self::Item>

Get inversed element by multiplication.
Source§

fn add_assign(&self, a: &mut Self::Item, b: &Self::Item)

Perform add_assign operation. By default it is implemented through add but it can be overridden for optimization purposes.
Source§

fn sub_assign(&self, a: &mut Self::Item, b: &Self::Item)

Perform sub_assign operation. By default it is implemented through sub but it can be overridden for optimization purposes.
Source§

fn neg_assign(&self, a: &mut Self::Item)

Perform neg_assign operation. By default it is implemented through neg but it can be overridden for optimization purposes.
Source§

fn mul_scalar<I>(&self, a: &Self::Item, bits_iter: I) -> Self::Item
where I: Iterator<Item = bool>,

Perform multiplication in the group by a scalar given as an iterator of bits according to the double and add algorithm.
Source§

fn pow_scalar<I>(&self, a: &Self::Item, bits_iter: I) -> Self::Item
where I: Iterator<Item = bool>,

Perform multiplication in the group by a scalar given as an iterator of bits according to the exponentiation by squaring algorithm.
Source§

fn div(&self, a: &Self::Item, b: &Self::Item) -> Option<Self::Item>

Perform div operation. By default it is implemented through mul and inv but it can be overridden for optimization purposes.
Source§

fn mul_assign(&self, a: &mut Self::Item, b: &Self::Item)

Perform mul_assign operation. By default it is implemented through mul but it can be overridden for optimization purposes.
Source§

fn div_assign(&self, a: &mut Self::Item, b: &Self::Item) -> Option<()>

Perform div_assign operation. By default it is implemented through div but it can be overridden for optimization purposes.
Source§

fn inv_assign(&self, a: &mut Self::Item) -> Option<()>

Perform inv_assign operation. By default it is implemented through inv but it can be overridden for optimization purposes.
Source§

fn mul_scalar_assign<I>(&self, a: &mut Self::Item, bits_iter: I)
where I: Iterator<Item = bool>,

Perform mul_scalar_assign operation. By default it is implemented
through mul_scalar but it can be overridden for optimization purposes.
Source§

fn pow_scalar_assign<I>(&self, a: &mut Self::Item, bits_iter: I)
where I: Iterator<Item = bool>,

Perform pow_scalar_assign operation. By default it is implemented
through pow_scalar but it can be overridden for optimization purposes.
Source§

fn as_add_group(&self) -> FieldAddGroup<'_, Self>

Represent the field as a group by addition.
Source§

fn as_mul_group(&self) -> FieldMulGroup<'_, Self>

Represent the field as a group by multiplication.

Auto Trait Implementations§

§

impl<R> Freeze for Binary<R>
where R: Freeze, <R as EuclideanRing>::Item: Freeze,

§

impl<R> RefUnwindSafe for Binary<R>

§

impl<R> Send for Binary<R>
where R: Send, <R as EuclideanRing>::Item: Send,

§

impl<R> Sync for Binary<R>
where R: Sync, <R as EuclideanRing>::Item: Sync,

§

impl<R> Unpin for Binary<R>
where R: Unpin, <R as EuclideanRing>::Item: Unpin,

§

impl<R> UnwindSafe for Binary<R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V