[][src]Struct isochronous_finite_fields::GF

pub struct GF(pub u8);

Galois field wrapper struct.

It is wrapped around an u8 type, to guarantee at compile time that all elements are in the finite field GF(28).

Methods

impl GF[src]

pub fn multiplicative_inverse(self) -> Self[src]

Calculates the multiplicative inverse. The multiplicative inverse is the element in the Galois field that results in a product of 1.

Example

let element = GF(148);
let inverse = element.multiplicative_inverse();

assert_eq!(element * inverse, GF(1));

Trait Implementations

impl Add<GF> for GF[src]

Adding two elements in the Galois field GF(28) is equal to doing an exclusive or (XOR) between the two elements. It is also equal to subtracting two elements.

type Output = Self

The resulting type after applying the + operator.

impl AddAssign<GF> for GF[src]

impl Clone for GF[src]

impl Copy for GF[src]

impl Debug for GF[src]

impl Eq for GF[src]

impl From<u8> for GF[src]

impl Hash for GF[src]

impl Mul<GF> for GF[src]

Multiplication in this finite field is multiplication modulo AES standardized irreducible polynomial x8 + x4 + x3 + x + 1 (or 0b1_0001_1011).

type Output = Self

The resulting type after applying the * operator.

impl MulAssign<GF> for GF[src]

impl Ord for GF[src]

impl PartialEq<GF> for GF[src]

impl PartialOrd<GF> for GF[src]

impl StructuralEq for GF[src]

impl StructuralPartialEq for GF[src]

impl Sub<GF> for GF[src]

Subtracting two elements in the Galois field GF(28) is equal to doing an exclusive or (XOR) between the two elements. It is also equal to adding two elements.

type Output = Self

The resulting type after applying the - operator.

impl SubAssign<GF> for GF[src]

Auto Trait Implementations

impl Send for GF

impl Sync for GF

impl Unpin for GF

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.