Skip to main content

RingGadget

Struct RingGadget 

Source
pub struct RingGadget<F> {
    pub ring: Vec<(u32, Flat<F>)>,
    pub mu: Vec<Flat<F>>,
    pub first_wire: u32,
    pub first_row: usize,
}
Expand description

Δ = Σ_c a_c φ(h_c) over the pad entries (pad, a_c) as the chain X_127 = T'_127, X_j = T'_j + X_{j+1}², T'_j = Σ_c σ^{-j}(μ_j a_c) h_c, on squaring wires first_wire + j - 1 for j = 1..128; Δ = X_0.

Fields§

§ring: Vec<(u32, Flat<F>)>§mu: Vec<Flat<F>>§first_wire: u32§first_row: usize

Statement row of Lhs_1; the chain occupies 2 · (BITS - 1) rows from there.

Implementations§

Source§

impl<F: HardwareField> RingGadget<F>

Source

pub fn new(ring: Vec<(u32, Flat<F>)>, mu: Vec<Flat<F>>, first_wire: u32) -> Self

Source

pub fn row_of(&self, j: usize) -> usize

Statement row of Lhs_j; Rhs_j follows it.

Source

pub fn for_each_tie_row(&self, f: impl FnMut(usize, &[Flat<F>]))

f(j, tie_j) for j = 127 down to 1, tie_j[c] = σ^{-j}(μ_j a_c); the coefficients of row Lhs_j on the pad entries.

Source

pub fn wire_rows(&self) -> Vec<AffineRow<F>>

Wire terms of the chain rows, in [row_of] order: Lhs_j + Product_{j+1} and Rhs_j + Lhs_j.

Source

pub fn delta_form(&self) -> Vec<(Unknown, Flat<F>)>

Δ over the pad entries and the wire Product_1.

Source

pub fn wires(&self, pad_values: &[Flat<F>]) -> Vec<[Flat<F>; 3]>

Honest [X_j, X_j, X_j²] for j = 1..128 from the pad values, indexed by wire.

Source

pub fn delta(&self, pad_values: &[Flat<F>]) -> Flat<F>

Δ = Σ_c a_c φ(h_c) on plaintext pad values.

Auto Trait Implementations§

§

impl<F> Freeze for RingGadget<F>
where Vec<(u32, Flat<F>)>: Freeze, Vec<Flat<F>>: Freeze,

§

impl<F> RefUnwindSafe for RingGadget<F>

§

impl<F> Send for RingGadget<F>
where Vec<(u32, Flat<F>)>: Send, Vec<Flat<F>>: Send,

§

impl<F> Sync for RingGadget<F>
where Vec<(u32, Flat<F>)>: Sync, Vec<Flat<F>>: Sync,

§

impl<F> Unpin for RingGadget<F>
where Vec<(u32, Flat<F>)>: Unpin, Vec<Flat<F>>: Unpin,

§

impl<F> UnsafeUnpin for RingGadget<F>
where Vec<(u32, Flat<F>)>: UnsafeUnpin, Vec<Flat<F>>: UnsafeUnpin,

§

impl<F> UnwindSafe for RingGadget<F>
where Vec<(u32, Flat<F>)>: UnwindSafe, Vec<Flat<F>>: UnwindSafe,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.