Skip to main content

GarbledCircuit

Struct GarbledCircuit 

Source
pub struct GarbledCircuit<W> { /* private fields */ }
Expand description

A garbled circuit.

A garbled circuit at its core is just a vector of garbled rows and constant wirelabels.

Implementations§

Source§

impl<W: WireLabel<F2>> GarbledCircuit<W>

Source

pub fn new(blocks: Vec<U8x16>) -> Self

Create a GarbledCircuit from a vector of garbled rows and constant wirelabels.

Source

pub fn size(&self) -> usize

The number of garbled rows and constant wires in the garbled circuit.

Source

pub fn garble<C: CircuitInputMapper<Garbler<W, RNG>> + CircuitOutputMapper<Garbler<W, RNG>>, RNG: CryptoRng + SeedableRng>( circuit: &C, rng: &mut RNG, ) -> Result<(Encoder<W>, Self)>

Garble a circuit.

This outputs an Encoder for encoding inputs into their associated wirelabels, and the garbled circuit itself.

Source

pub fn eval<C: CircuitOutputMapper<Evaluator<W>>>( &self, circuit: &C, inputs: C::Input, ) -> Result<Vec<F2>>

Evaluate the garbled circuit on the provided inputs, mapping the output wirelabels to their associated values.

Trait Implementations§

Source§

impl<W: Debug> Debug for GarbledCircuit<W>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<W> Freeze for GarbledCircuit<W>

§

impl<W> RefUnwindSafe for GarbledCircuit<W>
where W: RefUnwindSafe,

§

impl<W> Send for GarbledCircuit<W>
where W: Send,

§

impl<W> Sync for GarbledCircuit<W>
where W: Sync,

§

impl<W> Unpin for GarbledCircuit<W>
where W: Unpin,

§

impl<W> UnsafeUnpin for GarbledCircuit<W>

§

impl<W> UnwindSafe for GarbledCircuit<W>
where W: 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.

§

impl<T> IsSameType<T> for T

§

const WITNESS: Witness<<T as IsSameType<T>>::EqualityProposition> = Witness::EQUAL_TYPES

A [Witness] that Self == T Read more
§

type EqualityProposition = TrueEqualityProposition

The [EqualityProposition] that Self == T
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.