pub struct Rijndael8b(/* private fields */);Expand description
The binary field GF(2^8) modulo x^8 + x^4 + x^3 + x + 1.
Bit i stores the coefficient of x^i, and every byte is a distinct field element.
This is the modulus the byte-wise field instructions are defined for.
That is what makes it worth carrying beside the tower’s own byte field.
Arithmetic here is table-free: nothing indexes a table by an operand.
Implementations§
Source§impl Rijndael8b
impl Rijndael8b
Sourcepub const fn frobenius_map(power_log: usize) -> ByteMatrix
pub const fn frobenius_map(power_log: usize) -> ByteMatrix
The map raising every element to the power 2^k, for k the argument.
The orbit closes after eight steps, so the argument is taken modulo that.
Sourcepub fn frobenius_orbit(self) -> [Self; 8]
pub fn frobenius_orbit(self) -> [Self; 8]
This element raised to 2^k, for every k below the field’s degree.
These are the element’s conjugates with multiplicity, so a subfield element repeats.
Source§impl Rijndael8b
impl Rijndael8b
Sourcepub const fn from_byte(byte: u8) -> Self
pub const fn from_byte(byte: u8) -> Self
Construct a field element from its byte representation.
Every byte is a valid element.
Sourcepub const fn invert_or_zero(self) -> Self
pub const fn invert_or_zero(self) -> Self
The inverse of this element, with zero sent to zero.
The chain runs whatever the operand is, so its cost says nothing about the value.
Sourcepub const fn scaling_matrix(self) -> ByteMatrix
pub const fn scaling_matrix(self) -> ByteMatrix
Multiplication by this element, as a map ready for the byte-wise engine.
Scaling is F_2-linear, so a fixed factor is a matrix like any other.
Trait Implementations§
Source§impl Add for Rijndael8b
impl Add for Rijndael8b
Source§impl Add<Gf2> for Rijndael8b
impl Add<Gf2> for Rijndael8b
Source§impl<const N: usize> Add<PackedRijndael8b<N>> for Rijndael8b
impl<const N: usize> Add<PackedRijndael8b<N>> for Rijndael8b
Source§type Output = PackedRijndael8b<N>
type Output = PackedRijndael8b<N>
+ operator.Source§impl<const N: usize> Add<Rijndael8b> for PackedRijndael8b<N>
impl<const N: usize> Add<Rijndael8b> for PackedRijndael8b<N>
Source§type Output = PackedRijndael8b<N>
type Output = PackedRijndael8b<N>
+ operator.Source§fn add(self, rhs: Rijndael8b) -> Self
fn add(self, rhs: Rijndael8b) -> Self
+ operation. Read moreSource§impl Add<Rijndael8b> for Gf2
impl Add<Rijndael8b> for Gf2
Source§type Output = Rijndael8b
type Output = Rijndael8b
+ operator.Source§impl<T: Into<Self>> AddAssign<T> for Rijndael8b
impl<T: Into<Self>> AddAssign<T> for Rijndael8b
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
+= operation. Read moreSource§impl Algebra<Gf2> for Rijndael8b
impl Algebra<Gf2> for Rijndael8b
Source§fn quadratic_extension_square(a: &[Self; 2], w: F) -> [Self; 2]
fn quadratic_extension_square(a: &[Self; 2], w: F) -> [Self; 2]
Source§fn mixed_dot_product<const N: usize>(a: &[Self; N], f: &[F; N]) -> Selfwhere
F: Dup,
fn mixed_dot_product<const N: usize>(a: &[Self; N], f: &[F; N]) -> Selfwhere
F: Dup,
Source§const BATCHED_LC_CHUNK: usize = 8
const BATCHED_LC_CHUNK: usize = 8
batched_linear_combination. Read moreSource§impl<const N: usize> Algebra<Rijndael8b> for PackedRijndael8b<N>
impl<const N: usize> Algebra<Rijndael8b> for PackedRijndael8b<N>
Source§fn quadratic_extension_square(a: &[Self; 2], w: F) -> [Self; 2]
fn quadratic_extension_square(a: &[Self; 2], w: F) -> [Self; 2]
Source§fn mixed_dot_product<const N: usize>(a: &[Self; N], f: &[F; N]) -> Selfwhere
F: Dup,
fn mixed_dot_product<const N: usize>(a: &[Self; N], f: &[F; N]) -> Selfwhere
F: Dup,
Source§const BATCHED_LC_CHUNK: usize = 8
const BATCHED_LC_CHUNK: usize = 8
batched_linear_combination. Read moreSource§impl Clone for Rijndael8b
impl Clone for Rijndael8b
impl Copy for Rijndael8b
Source§impl Debug for Rijndael8b
impl Debug for Rijndael8b
Source§impl Default for Rijndael8b
impl Default for Rijndael8b
Source§impl<'de> Deserialize<'de> for Rijndael8b
impl<'de> Deserialize<'de> for Rijndael8b
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for Rijndael8b
impl Display for Rijndael8b
Source§impl Distribution<Rijndael8b> for StandardUniform
impl Distribution<Rijndael8b> for StandardUniform
Source§impl Div for Rijndael8b
impl Div for Rijndael8b
Source§type Output = Rijndael8b
type Output = Rijndael8b
/ operator.Source§fn div(self, rhs: Rijndael8b) -> Self
fn div(self, rhs: Rijndael8b) -> Self
/ operation. Read moreSource§impl<const N: usize> Div<Rijndael8b> for PackedRijndael8b<N>
impl<const N: usize> Div<Rijndael8b> for PackedRijndael8b<N>
Source§type Output = PackedRijndael8b<N>
type Output = PackedRijndael8b<N>
/ operator.Source§fn div(self, rhs: Rijndael8b) -> Self
fn div(self, rhs: Rijndael8b) -> Self
/ operation. Read moreSource§impl DivAssign for Rijndael8b
impl DivAssign for Rijndael8b
Source§fn div_assign(&mut self, rhs: Rijndael8b)
fn div_assign(&mut self, rhs: Rijndael8b)
/= operation. Read moreSource§impl<const N: usize> DivAssign<Rijndael8b> for PackedRijndael8b<N>
impl<const N: usize> DivAssign<Rijndael8b> for PackedRijndael8b<N>
Source§fn div_assign(&mut self, rhs: Rijndael8b)
fn div_assign(&mut self, rhs: Rijndael8b)
/= operation. Read moreimpl Eq for Rijndael8b
Source§impl Field for Rijndael8b
impl Field for Rijndael8b
Source§fn interpolation_node(i: usize) -> Self
fn interpolation_node(i: usize) -> Self
The enumeration by bit pattern.
The coordinates of the returned element over GF(2) are the bits of the index.
§Panics
Panics if the index does not fit in a byte, which would otherwise alias an earlier node.
type Packing = PackedRijndael8b<{ packed::PACKING_WIDTH }>
Source§fn try_inverse(&self) -> Option<Self>
fn try_inverse(&self) -> Option<Self>
Source§fn try_sqrt(&self) -> Option<Self>
fn try_sqrt(&self) -> Option<Self>
Source§const BENEFITS_FROM_LOCKSTEP_EVALUATION: bool = false
const BENEFITS_FROM_LOCKSTEP_EVALUATION: bool = false
Source§fn is_zero(&self) -> bool
fn is_zero(&self) -> bool
Source§fn is_one(&self) -> bool
fn is_one(&self) -> bool
Source§fn add_slices(slice_1: &mut [Self], slice_2: &[Self])
fn add_slices(slice_1: &mut [Self], slice_2: &[Self])
Source§fn batched_columnwise_dot_product<EF, R, I, const N: usize>(
acc: &mut [<EF as ExtensionField<Self>>::ExtensionPacking],
items: I,
)where
EF: ExtensionField<Self>,
R: Iterator<Item = Self::Packing>,
I: Iterator<Item = (R, [EF; N])>,
fn batched_columnwise_dot_product<EF, R, I, const N: usize>(
acc: &mut [<EF as ExtensionField<Self>>::ExtensionPacking],
items: I,
)where
EF: ExtensionField<Self>,
R: Iterator<Item = Self::Packing>,
I: Iterator<Item = (R, [EF; N])>,
acc[c * N + j] += scales[j] * row[c] over a stream of packed rows. Read moreSource§impl From<BinaryField8> for Rijndael8b
impl From<BinaryField8> for Rijndael8b
Source§fn from(x: BinaryField8) -> Self
fn from(x: BinaryField8) -> Self
The same field element, seen in the polynomial basis.
Source§impl From<Gf2> for Rijndael8b
impl From<Gf2> for Rijndael8b
Source§impl<const N: usize> From<Rijndael8b> for PackedRijndael8b<N>
impl<const N: usize> From<Rijndael8b> for PackedRijndael8b<N>
Source§fn from(value: Rijndael8b) -> Self
fn from(value: Rijndael8b) -> Self
Source§impl From<Rijndael8b> for BinaryField8
impl From<Rijndael8b> for BinaryField8
Source§fn from(x: Rijndael8b) -> Self
fn from(x: Rijndael8b) -> Self
The same field element, seen in the tower basis.
Source§impl Hash for Rijndael8b
impl Hash for Rijndael8b
Source§impl Mul for Rijndael8b
impl Mul for Rijndael8b
Source§impl Mul<Gf2> for Rijndael8b
impl Mul<Gf2> for Rijndael8b
Source§impl<const N: usize> Mul<PackedRijndael8b<N>> for Rijndael8b
impl<const N: usize> Mul<PackedRijndael8b<N>> for Rijndael8b
Source§type Output = PackedRijndael8b<N>
type Output = PackedRijndael8b<N>
* operator.Source§impl<const N: usize> Mul<Rijndael8b> for PackedRijndael8b<N>
impl<const N: usize> Mul<Rijndael8b> for PackedRijndael8b<N>
Source§fn mul(self, rhs: Rijndael8b) -> Self
fn mul(self, rhs: Rijndael8b) -> Self
A broadcast plus the byte-wise product beats tabulating the factor as a map.
Callers holding one factor across a loop should hoist its matrix and sweep with that.
Source§type Output = PackedRijndael8b<N>
type Output = PackedRijndael8b<N>
* operator.Source§impl Mul<Rijndael8b> for Gf2
impl Mul<Rijndael8b> for Gf2
Source§type Output = Rijndael8b
type Output = Rijndael8b
* operator.Source§impl<T: Into<Self>> MulAssign<T> for Rijndael8b
impl<T: Into<Self>> MulAssign<T> for Rijndael8b
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*= operation. Read moreSource§impl Neg for Rijndael8b
impl Neg for Rijndael8b
Source§impl Ord for Rijndael8b
impl Ord for Rijndael8b
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
impl Packable for Rijndael8b
Source§impl PartialEq for Rijndael8b
impl PartialEq for Rijndael8b
Source§impl PartialOrd for Rijndael8b
impl PartialOrd for Rijndael8b
Source§impl PrimeCharacteristicRing for Rijndael8b
impl PrimeCharacteristicRing for Rijndael8b
Source§fn div_2exp_u64(&self, _exp: u64) -> Self
fn div_2exp_u64(&self, _exp: u64) -> Self
§Panics
Always panics: 2 is not invertible in characteristic 2.
Source§fn exp_power_of_2(&self, power_log: usize) -> Self
fn exp_power_of_2(&self, power_log: usize) -> Self
Raising to 2^k is one tabulated map, whatever the exponent.
Source§type PrimeSubfield = Gf2
type PrimeSubfield = Gf2
ℤ/p where the characteristic of this ring is p.Source§fn from_prime_subfield(f: Self::PrimeSubfield) -> Self
fn from_prime_subfield(f: Self::PrimeSubfield) -> Self
Source§fn xor(&self, y: &Self) -> Self
fn xor(&self, y: &Self) -> Self
xor. Read moreSource§fn mul_2exp_u64(&self, exp: u64) -> Self
fn mul_2exp_u64(&self, exp: u64) -> Self
mul_2exp_u64(a, exp) = a * 2^{exp}. Read moreSource§fn from_usize(int: usize) -> Self
fn from_usize(int: usize) -> Self
Source§fn from_isize(int: isize) -> Self
fn from_isize(int: isize) -> Self
Source§fn xor3(&self, y: &Self, z: &Self) -> Self
fn xor3(&self, y: &Self, z: &Self) -> Self
xor. Read moreSource§fn bool_check(&self) -> Self
fn bool_check(&self) -> Self
x * (x - 1). Read moreSource§fn exp_const_u64<const POWER: u64>(&self) -> Self
fn exp_const_u64<const POWER: u64>(&self) -> Self
Source§fn powers(&self) -> Powers<Self> ⓘ
fn powers(&self) -> Powers<Self> ⓘ
self: self^0, self^1, self^2, ....Source§fn shifted_powers(&self, start: Self) -> Powers<Self> ⓘ
fn shifted_powers(&self, start: Self) -> Powers<Self> ⓘ
self shifted by start: start, start*self^1, start*self^2, ....Source§fn dot_product<const N: usize>(u: &[Self; N], v: &[Self; N]) -> Self
fn dot_product<const N: usize>(u: &[Self; N], v: &[Self; N]) -> Self
Source§fn sum_array<const N: usize>(input: &[Self]) -> Self
fn sum_array<const N: usize>(input: &[Self]) -> Self
Source§fn zero_vec(len: usize) -> Vec<Self>
fn zero_vec(len: usize) -> Vec<Self>
len. Many operating systems zero pages
before assigning them to a userspace process. In that case, our process should not need to
write zeros, which would be redundant. However, the compiler may not always recognize this. Read moreSource§impl Product for Rijndael8b
impl Product for Rijndael8b
Source§impl<const N: usize> Product<Rijndael8b> for PackedRijndael8b<N>
impl<const N: usize> Product<Rijndael8b> for PackedRijndael8b<N>
Source§fn product<I: Iterator<Item = Rijndael8b>>(iter: I) -> Self
fn product<I: Iterator<Item = Rijndael8b>>(iter: I) -> Self
Self from the elements by multiplying
the items.Source§impl RawDataSerializable for Rijndael8b
impl RawDataSerializable for Rijndael8b
Source§const NUM_BYTES: usize = 1
const NUM_BYTES: usize = 1
Source§fn into_bytes(self) -> impl IntoIterator<Item = u8>
fn into_bytes(self) -> impl IntoIterator<Item = u8>
Source§fn into_byte_stream(
input: impl IntoIterator<Item = Self>,
) -> impl IntoIterator<Item = u8>
fn into_byte_stream( input: impl IntoIterator<Item = Self>, ) -> impl IntoIterator<Item = u8>
Source§fn into_u32_stream(
input: impl IntoIterator<Item = Self>,
) -> impl IntoIterator<Item = u32>
fn into_u32_stream( input: impl IntoIterator<Item = Self>, ) -> impl IntoIterator<Item = u32>
Source§fn into_u64_stream(
input: impl IntoIterator<Item = Self>,
) -> impl IntoIterator<Item = u64>
fn into_u64_stream( input: impl IntoIterator<Item = Self>, ) -> impl IntoIterator<Item = u64>
Source§fn into_parallel_byte_streams<const N: usize>(
input: impl IntoIterator<Item = [Self; N]>,
) -> impl IntoIterator<Item = [u8; N]>
fn into_parallel_byte_streams<const N: usize>( input: impl IntoIterator<Item = [Self; N]>, ) -> impl IntoIterator<Item = [u8; N]>
Source§fn into_parallel_u32_streams<const N: usize>(
input: impl IntoIterator<Item = [Self; N]>,
) -> impl IntoIterator<Item = [u32; N]>
fn into_parallel_u32_streams<const N: usize>( input: impl IntoIterator<Item = [Self; N]>, ) -> impl IntoIterator<Item = [u32; N]>
Source§fn into_parallel_u64_streams<const N: usize>(
input: impl IntoIterator<Item = [Self; N]>,
) -> impl IntoIterator<Item = [u64; N]>
fn into_parallel_u64_streams<const N: usize>( input: impl IntoIterator<Item = [Self; N]>, ) -> impl IntoIterator<Item = [u64; N]>
Source§impl Serialize for Rijndael8b
impl Serialize for Rijndael8b
impl StructuralPartialEq for Rijndael8b
Source§impl Sub for Rijndael8b
impl Sub for Rijndael8b
Source§impl Sub<Gf2> for Rijndael8b
impl Sub<Gf2> for Rijndael8b
Source§impl<const N: usize> Sub<PackedRijndael8b<N>> for Rijndael8b
impl<const N: usize> Sub<PackedRijndael8b<N>> for Rijndael8b
Source§type Output = PackedRijndael8b<N>
type Output = PackedRijndael8b<N>
- operator.Source§impl<const N: usize> Sub<Rijndael8b> for PackedRijndael8b<N>
impl<const N: usize> Sub<Rijndael8b> for PackedRijndael8b<N>
Source§type Output = PackedRijndael8b<N>
type Output = PackedRijndael8b<N>
- operator.Source§fn sub(self, rhs: Rijndael8b) -> Self
fn sub(self, rhs: Rijndael8b) -> Self
- operation. Read moreSource§impl Sub<Rijndael8b> for Gf2
impl Sub<Rijndael8b> for Gf2
Source§type Output = Rijndael8b
type Output = Rijndael8b
- operator.Source§impl<T: Into<Self>> SubAssign<T> for Rijndael8b
impl<T: Into<Self>> SubAssign<T> for Rijndael8b
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
-= operation. Read moreSource§impl Sum for Rijndael8b
impl Sum for Rijndael8b
Source§impl<const N: usize> Sum<Rijndael8b> for PackedRijndael8b<N>
impl<const N: usize> Sum<Rijndael8b> for PackedRijndael8b<N>
Source§fn sum<I: Iterator<Item = Rijndael8b>>(iter: I) -> Self
fn sum<I: Iterator<Item = Rijndael8b>>(iter: I) -> Self
Self from the elements by “summing up”
the items.Source§impl TowerLevel for Rijndael8b
impl TowerLevel for Rijndael8b
Source§fn mul_alpha(self) -> Self
fn mul_alpha(self) -> Self
The tower scales by a basis vector, which costs it a shift.
Here the same element is an arbitrary one, so it costs a full product.
Source§fn from_le_byte_iter(bytes: impl Iterator<Item = u8>) -> Self
fn from_le_byte_iter(bytes: impl Iterator<Item = u8>) -> Self
§Panics
Panics if the stream ends before a whole element has been read.
Source§fn cantor_basis(i: usize) -> Self
fn cantor_basis(i: usize) -> Self
§Panics
Panics if the index is at least the bit width of the field.
Auto Trait Implementations§
impl Freeze for Rijndael8b
impl RefUnwindSafe for Rijndael8b
impl Send for Rijndael8b
impl Sync for Rijndael8b
impl Unpin for Rijndael8b
impl UnsafeUnpin for Rijndael8b
impl UnwindSafe for Rijndael8b
Blanket Implementations§
Source§impl<R> Algebra<R> for Rwhere
R: PrimeCharacteristicRing,
impl<R> Algebra<R> for Rwhere
R: PrimeCharacteristicRing,
Source§fn mixed_dot_product<const N: usize>(a: &[R; N], f: &[R; N]) -> R
fn mixed_dot_product<const N: usize>(a: &[R; N], f: &[R; N]) -> R
Source§fn quadratic_extension_square(a: &[Self; 2], w: F) -> [Self; 2]
fn quadratic_extension_square(a: &[Self; 2], w: F) -> [Self; 2]
Source§const BATCHED_LC_CHUNK: usize = 8
const BATCHED_LC_CHUNK: usize = 8
batched_linear_combination. Read moreSource§impl<F> AlgebraIdentity<F> for Fwhere
F: PrimeCharacteristicRing,
impl<F> AlgebraIdentity<F> for Fwhere
F: PrimeCharacteristicRing,
Source§impl<F> BasedVectorSpace<F> for Fwhere
F: PrimeCharacteristicRing,
impl<F> BasedVectorSpace<F> for Fwhere
F: PrimeCharacteristicRing,
Source§const DIMENSION: usize = 1
const DIMENSION: usize = 1
Source§fn as_basis_coefficients_slice(&self) -> &[F]
fn as_basis_coefficients_slice(&self) -> &[F]
A and uses this to
map an element of A to a slice of DIMENSION F elements. Read moreSource§fn from_basis_coefficients_fn<Fn>(f: Fn) -> F
fn from_basis_coefficients_fn<Fn>(f: Fn) -> F
A and uses this to
map DIMENSION F elements to an element of A. Similar
to core:array::from_fn, the DIMENSION F elements are
given by Fn(0), ..., Fn(DIMENSION - 1) called in that order. Read moreSource§fn from_basis_coefficients_iter<I>(iter: I) -> Option<F>where
I: ExactSizeIterator<Item = F>,
fn from_basis_coefficients_iter<I>(iter: I) -> Option<F>where
I: ExactSizeIterator<Item = F>,
A and uses this to
map DIMENSION F elements to an element of A. Read moreSource§fn flatten_to_base(vec: Vec<F>) -> Vec<F>
fn flatten_to_base(vec: Vec<F>) -> Vec<F>
Source§fn reconstitute_from_base(vec: Vec<F>) -> Vec<F>
fn reconstitute_from_base(vec: Vec<F>) -> Vec<F>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<F> ExtensionField<F> for Fwhere
F: Field,
impl<F> ExtensionField<F> for Fwhere
F: Field,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F> PackedField for Fwhere
F: Field,
impl<F> PackedField for Fwhere
F: Field,
type Scalar = F
Source§fn packed_powers(base: Self::Scalar) -> Powers<Self> ⓘ
fn packed_powers(base: Self::Scalar) -> Powers<Self> ⓘ
base packed into packed field elements. Read more