Skip to main content

Garbler

Struct Garbler 

Source
pub struct Garbler<W, RNG> { /* private fields */ }
Expand description

The garbled circuit garbler.

This is the party that produces the garbled circuit to be evaluated by an crate::Evaluator.

Implementations§

Source§

impl<W: WireLabel<F2>, RNG: CryptoRng> Garbler<W, RNG>

Source

pub fn new(rng: RNG) -> Self

Create a new Garbler.

Source

pub fn delta(&self) -> W

The Δ wirelabel.

Trait Implementations§

Source§

impl<W: WireLabel<F2>, RNG> Fancy for Garbler<W, RNG>

Source§

type Item = W

The underlying wire representation of this [Fancy] object.
Source§

impl<W: BinaryWireLabel, RNG: CryptoRng> FancyBinary for Garbler<W, RNG>

Source§

fn and( &mut self, x: &Self::Item, y: &Self::Item, channel: &mut Channel<'_>, ) -> Result<Self::Item>

Binary AND.
Source§

fn xor(&mut self, x: &Self::Item, y: &Self::Item) -> Self::Item

Binary XOR.
Source§

fn negate(&mut self, x: &Self::Item) -> Self::Item

Binary negation.
§

fn or( &mut self, x: &Self::Item, y: &Self::Item, channel: &mut Channel<'_>, ) -> Result<Self::Item, Error>

Binary OR.
Source§

impl<W: WireLabel<F2>, RNG> FancyConstant<F2> for Garbler<W, RNG>

Source§

fn constant(&mut self, x: F2) -> Self::Item

Encode a constant value x.
Source§

impl<W: WireLabel<F2>, RNG: CryptoRng> FancyEncode<F2> for Garbler<W, RNG>

Source§

fn encode_many( &mut self, values: &[F2], channel: &mut Channel<'_>, ) -> Result<Vec<Self::Item>>

Encode many wires for known values.
§

fn encode( &mut self, value: FF, channel: &mut Channel<'_>, ) -> Result<Self::Item, Error>

Encode a wire for a known value.
Source§

impl<W: WireLabel<F2>, RNG: CryptoRng> FancyOutput<F2> for Garbler<W, RNG>

Source§

fn output(&mut self, x: &W, channel: &mut Channel<'_>) -> Result<Option<F2>>

Output the value associated with a [Fancy::Item]. Read more
§

fn outputs( &mut self, xs: &[Self::Item], channel: &mut Channel<'_>, ) -> Result<Option<Vec<FF>>, Error>

Output the values associated with a slice of [Fancy::Item]s. Read more

Auto Trait Implementations§

§

impl<W, RNG> Freeze for Garbler<W, RNG>
where W: Freeze, RNG: Freeze,

§

impl<W, RNG> RefUnwindSafe for Garbler<W, RNG>

§

impl<W, RNG> Send for Garbler<W, RNG>
where W: Send, RNG: Send,

§

impl<W, RNG> Sync for Garbler<W, RNG>
where W: Sync, RNG: Sync,

§

impl<W, RNG> Unpin for Garbler<W, RNG>
where W: Unpin, RNG: Unpin,

§

impl<W, RNG> UnsafeUnpin for Garbler<W, RNG>
where W: UnsafeUnpin, RNG: UnsafeUnpin,

§

impl<W, RNG> UnwindSafe for Garbler<W, RNG>
where W: UnwindSafe, RNG: 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
§

impl<F> BinaryEncode for F
where F: FancyEncode<F2>,

§

fn bin_encode<const N: usize>( &mut self, value: u128, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item, N>, Error>

Encode a u128 as a [BinaryBundle].
§

fn bin_encode_many<const N: usize>( &mut self, values: &[u128], channel: &mut Channel<'_>, ) -> Result<Vec<BinaryBundle<Self::Item, N>>, Error>

Encode a slice of u128s as a vector of [BinaryBundle]s.
§

impl<F> BinaryOutput for F
where F: FancyOutput<F2>,

§

fn bin_output<const N: usize>( &mut self, x: &BinaryBundle<Self::Item, N>, channel: &mut Channel<'_>, ) -> Result<Option<u128>, Error>

Output a [BinaryBundle] as a u128.
§

fn bin_outputs<const N: usize>( &mut self, xs: &[BinaryBundle<Self::Item, N>], channel: &mut Channel<'_>, ) -> Result<Option<Vec<u128>>, Error>

Output a slice of [BinaryBundle]s as a vector of u128s.
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.