Skip to main content

Block16

Struct Block16 

Source
#[repr(transparent)]
pub struct Block16(pub u16);

Tuple Fields§

§0: u16

Implementations§

Source§

impl Block16

Source

pub const TAU: Self

Source

pub fn new(lo: Block8, hi: Block8) -> Self

Source

pub fn split(self) -> (Block8, Block8)

Trait Implementations§

Source§

impl Add for Block16

Source§

type Output = Block16

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl AddAssign for Block16

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl BinaryFieldExtras for Block16

Source§

fn square(&self) -> Self

Source§

fn trace(&self) -> Bit

Absolute trace Tr_{F/GF(2)}(x) = Σ x^(2^i), always 0 or 1.
Source§

fn solve_quadratic(c: Self) -> Option<Self>

A root of x^2 + x = c, or None iff Tr(c) != 0 (then it has no solution). When solvable, the roots are the result and result + ONE. The value path is constant-time; only the Some/None choice reveals Tr(c).
Source§

fn frobenius(&self, k: u32) -> Self

x^(2^k). k is taken mod the field degree (x^(2^BITS) = x), so any k is valid.
Source§

impl CanonicalDeserialize for Block16

Source§

fn deserialize(bytes: &[u8]) -> Result<Self, ()>

Deserializes from a buffer. Returns Err if buffer is too short.
Source§

impl CanonicalSerialize for Block16

Source§

fn serialized_size(&self) -> usize

Returns the size in bytes.
Source§

fn serialize(&self, writer: &mut [u8]) -> Result<(), ()>

Serializes the element into a buffer. Returns error if buffer is too small.
Source§

fn to_bytes(&self) -> Vec<u8>

Convenience method: returns a Vec.
Source§

impl Clone for Block16

Source§

fn clone(&self) -> Block16

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Block16

Source§

impl Debug for Block16

Source§

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

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

impl Default for Block16

Source§

fn default() -> Block16

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Block16

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Block16

Source§

impl FlatPromote<Block8> for Block16

Source§

fn promote_flat(val: Flat<Block8>) -> Flat<Self>

Source§

fn promote_flat_batch(input: &[Flat<FromF>], output: &mut [Flat<Self>])

Batch promote a slice of flat elements. Read more
Source§

impl FlatPromote<Block16> for Block128

Available on non-crate feature table-math only.
Source§

fn promote_flat(val: Flat<Block16>) -> Flat<Self>

Source§

fn promote_flat_batch(input: &[Flat<Block16>], output: &mut [Flat<Self>])

Batch promote a slice of flat elements. Read more
Source§

impl FlatPromote<Block16> for Block256

Source§

fn promote_flat(val: Flat<Block16>) -> Flat<Self>

Source§

fn promote_flat_batch(input: &[Flat<Block16>], output: &mut [Flat<Self>])

Batch promote a slice of flat elements. Read more
Source§

impl From<Bit> for Block16

Source§

fn from(val: Bit) -> Self

Converts to this type from the input type.
Source§

impl From<Block8> for Block16

Source§

fn from(val: Block8) -> Self

Converts to this type from the input type.
Source§

impl From<Block16> for Block128

Source§

fn from(val: Block16) -> Self

Converts to this type from the input type.
Source§

impl From<Block16> for Block256

Source§

fn from(val: Block16) -> Self

Converts to this type from the input type.
Source§

impl From<Block16> for Block32

Source§

fn from(val: Block16) -> Self

Converts to this type from the input type.
Source§

impl From<Block16> for Block64

Source§

fn from(val: Block16) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Block16

Source§

fn from(val: u8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Block16

Source§

fn from(val: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Block16

Source§

fn from(val: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Block16

Source§

fn from(val: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for Block16

Source§

fn from(val: u128) -> Self

Converts to this type from the input type.
Source§

impl HardwareField for Block16

Source§

fn to_hardware(self) -> Flat<Self>

Convert standard Tower element to hardware basis (Isomorphic).
Source§

fn from_hardware(value: Flat<Self>) -> Self

Convert hardware element back to Tower basis.
Source§

fn add_hardware(lhs: Flat<Self>, rhs: Flat<Self>) -> Flat<Self>

Sum two elements assuming they are already in hardware basis.
Source§

fn add_hardware_packed( lhs: PackedFlat<Self>, rhs: PackedFlat<Self>, ) -> PackedFlat<Self>

Sum packed vectors in hardware basis.
Source§

fn mul_hardware(lhs: Flat<Self>, rhs: Flat<Self>) -> Flat<Self>

Multiply two elements assuming they are already in hardware basis.
Source§

fn mul_hardware_packed( lhs: PackedFlat<Self>, rhs: PackedFlat<Self>, ) -> PackedFlat<Self>

Multiply packed vectors in hardware basis.
Source§

fn mul_hardware_scalar_packed( lhs: PackedFlat<Self>, rhs: Flat<Self>, ) -> PackedFlat<Self>

Multiply packed vectors by a scalar in hardware basis.
Source§

fn tower_bit_from_hardware(value: Flat<Self>, bit_idx: usize) -> u8

Extracts the bit_idx bit of the canonical Tower representation directly from the Hardware (Flat) representation without a full basis conversion. Strictly constant time.
Source§

impl Mul for Block16

Source§

type Output = Block16

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
Source§

impl Mul<Block16> for PackedBlock16

Source§

type Output = PackedBlock16

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Block16) -> Self

Performs the * operation. Read more
Source§

impl MulAssign for Block16

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl PackableField for Block16

Source§

const WIDTH: usize = PACKED_WIDTH_16

How many elements fit in one packed vector.
Source§

type Packed = PackedBlock16

The packed vector type (e.g., PackedBlock128).
Source§

fn pack(chunk: &[Self]) -> Self::Packed

Pack a slice of scalars into a vector. Panics if slice len < WIDTH.
Source§

fn unpack(packed: Self::Packed, output: &mut [Self])

Unpack vector back to scalars.
Source§

impl PartialEq for Block16

Source§

fn eq(&self, other: &Block16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Block16

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Block16

Source§

impl Sub for Block16

Source§

type Output = Block16

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
Source§

impl SubAssign for Block16

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl TowerField for Block16

Source§

const BITS: usize = 16

Source§

const ZERO: Self

Source§

const ONE: Self

Source§

const EXTENSION_TAU: Self = Self::TAU

The constant TAU needed to extend this field to the next level. If we are in F, then the next field F’ is constructed as F[X] / (X^2 + X + EXTENSION_TAU).
Source§

fn invert(&self) -> Self

Returns the multiplicative inverse of the element. By cryptographic convention, the inverse of 0 is defined as 0 to ensure constant-time execution without branching.
Source§

fn from_uniform_bytes(bytes: &[u8; 32]) -> Self

Constructs a field element from uniform bytes (e.g. hash output). Used for PRNG / Blinding. Read more
Source§

impl Zeroize for Block16

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<F> FlatPromote<F> for F
where F: HardwareField,

Source§

fn promote_flat(val: Flat<F>) -> Flat<F>

Source§

fn promote_flat_batch(input: &[Flat<FromF>], output: &mut [Flat<Self>])

Batch promote a slice of flat elements. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.