pub struct Garbler<RNG, Wire> { /* private fields */ }Expand description
Streams garbled circuit ciphertexts through a callback.
Implementations§
Source§impl<RNG: CryptoRng + Rng, Wire: WireLabel + DeserializeOwned> Garbler<RNG, Wire>
impl<RNG: CryptoRng + Rng, Wire: WireLabel + DeserializeOwned> Garbler<RNG, Wire>
Source§impl<RNG: CryptoRng + Rng, Wire: WireLabel> Garbler<RNG, Wire>
impl<RNG: CryptoRng + Rng, Wire: WireLabel> Garbler<RNG, Wire>
Sourcepub fn delta(&mut self, q: u16) -> Wire
pub fn delta(&mut self, q: u16) -> Wire
Create a delta if it has not been created yet for this modulus, otherwise just return the existing one.
Sourcepub fn get_deltas(self) -> HashMap<u16, Wire>
pub fn get_deltas(self) -> HashMap<u16, Wire>
Get the deltas, consuming the Garbler.
This is useful for reusing wires in multiple garbled circuit instances.
Sourcepub fn encode_zero(&mut self, modulus: u16) -> Wire
pub fn encode_zero(&mut self, modulus: u16) -> Wire
Output a fresh zero wirelabel associated with the provided modulus.
Trait Implementations§
Source§impl<RNG: Rng + CryptoRng, Wire: WireLabel + ArithmeticWire> FancyArithmetic for Garbler<RNG, Wire>
impl<RNG: Rng + CryptoRng, Wire: WireLabel + ArithmeticWire> FancyArithmetic for Garbler<RNG, Wire>
Source§impl<RNG: Rng + CryptoRng> FancyBinary for Garbler<RNG, AllWire>
impl<RNG: Rng + CryptoRng> FancyBinary for Garbler<RNG, AllWire>
Source§fn negate(&mut self, x: &Self::Item) -> Self::Item
fn negate(&mut self, x: &Self::Item) -> Self::Item
We can negate by having garbler xor wire with Delta
Since we treat all garbler wires as zero, xoring with delta conceptually negates the value of the wire
Source§impl<RNG: Rng + CryptoRng, W: BinaryWireLabel> FancyBinary for Garbler<RNG, W>
impl<RNG: Rng + CryptoRng, W: BinaryWireLabel> FancyBinary for Garbler<RNG, W>
Source§fn negate(&mut self, x: &Self::Item) -> Self::Item
fn negate(&mut self, x: &Self::Item) -> Self::Item
We can negate by having garbler xor wire with Delta
Since we treat all garbler wires as zero, xoring with delta conceptually negates the value of the wire
Source§impl<RNG: Rng + CryptoRng, Wire: WireLabel> FancyEncode for Garbler<RNG, Wire>
impl<RNG: Rng + CryptoRng, Wire: WireLabel> FancyEncode for Garbler<RNG, Wire>
Source§fn encode_many(
&mut self,
values: &[u16],
moduli: &[u16],
channel: &mut Channel<'_>,
) -> Result<Vec<Self::Item>>
fn encode_many( &mut self, values: &[u16], moduli: &[u16], channel: &mut Channel<'_>, ) -> Result<Vec<Self::Item>>
Encode many wires for known values.
Source§fn receive_many(
&mut self,
_moduli: &[u16],
_: &mut Channel<'_>,
) -> Result<Vec<Self::Item>>
fn receive_many( &mut self, _moduli: &[u16], _: &mut Channel<'_>, ) -> Result<Vec<Self::Item>>
Receive many wires for unknown values.
Auto Trait Implementations§
impl<RNG, Wire> Freeze for Garbler<RNG, Wire>
impl<RNG, Wire> RefUnwindSafe for Garbler<RNG, Wire>where
Wire: RefUnwindSafe,
RNG: RefUnwindSafe,
impl<RNG, Wire> Send for Garbler<RNG, Wire>
impl<RNG, Wire> Sync for Garbler<RNG, Wire>
impl<RNG, Wire> Unpin for Garbler<RNG, Wire>
impl<RNG, Wire> UnsafeUnpin for Garbler<RNG, Wire>where
Wire: UnsafeUnpin,
RNG: UnsafeUnpin,
impl<RNG, Wire> UnwindSafe for Garbler<RNG, Wire>where
Wire: UnwindSafe,
RNG: UnwindSafe,
Blanket Implementations§
§impl<F> BinaryGadgets for Fwhere
F: FancyBinary + FancyEncode + FancyOutput,
impl<F> BinaryGadgets for Fwhere
F: FancyBinary + FancyEncode + FancyOutput,
§fn bin_encode(
&mut self,
value: u128,
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>, Error>
fn bin_encode( &mut self, value: u128, nbits: usize, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>, Error>
Encode a binary input bundle.
§fn bin_receive(
&mut self,
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>, Error>
fn bin_receive( &mut self, nbits: usize, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>, Error>
Receive an binary input bundle.
§fn bin_encode_many(
&mut self,
values: &[u128],
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<Vec<BinaryBundle<Self::Item>>, Error>
fn bin_encode_many( &mut self, values: &[u128], nbits: usize, channel: &mut Channel<'_>, ) -> Result<Vec<BinaryBundle<Self::Item>>, Error>
Encode many binary input bundles.
§fn bin_receive_many(
&mut self,
ninputs: usize,
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<Vec<BinaryBundle<Self::Item>>, Error>
fn bin_receive_many( &mut self, ninputs: usize, nbits: usize, channel: &mut Channel<'_>, ) -> Result<Vec<BinaryBundle<Self::Item>>, Error>
Receive many binary input bundles.
§fn bin_output(
&mut self,
x: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Option<u128>, Error>
fn bin_output( &mut self, x: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Option<u128>, Error>
Output a binary bundle and interpret the result as a
u128.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
Mutably borrows from an owned value. Read more
§impl<F> CrtGadgets for Fwhere
F: FancyArithmetic + FancyBinary + FancyEncode + FancyOutput,
impl<F> CrtGadgets for Fwhere
F: FancyArithmetic + FancyBinary + FancyEncode + FancyOutput,
§fn crt_encode(
&mut self,
value: u128,
modulus: u128,
channel: &mut Channel<'_>,
) -> Result<CrtBundle<Self::Item>, Error>
fn crt_encode( &mut self, value: u128, modulus: u128, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>, Error>
Encode a CRT input bundle.
§fn crt_receive(
&mut self,
modulus: u128,
channel: &mut Channel<'_>,
) -> Result<CrtBundle<Self::Item>, Error>
fn crt_receive( &mut self, modulus: u128, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>, Error>
Receive an CRT input bundle.
§fn crt_encode_many(
&mut self,
values: &[u128],
modulus: u128,
channel: &mut Channel<'_>,
) -> Result<Vec<CrtBundle<Self::Item>>, Error>
fn crt_encode_many( &mut self, values: &[u128], modulus: u128, channel: &mut Channel<'_>, ) -> Result<Vec<CrtBundle<Self::Item>>, Error>
Encode many CRT input bundles.
§fn crt_receive_many(
&mut self,
n: usize,
modulus: u128,
channel: &mut Channel<'_>,
) -> Result<Vec<CrtBundle<Self::Item>>, Error>
fn crt_receive_many( &mut self, n: usize, modulus: u128, channel: &mut Channel<'_>, ) -> Result<Vec<CrtBundle<Self::Item>>, Error>
Receive many CRT input bundles.
§fn crt_output(
&mut self,
x: &CrtBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Option<u128>, Error>
fn crt_output( &mut self, x: &CrtBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Option<u128>, Error>
Output a CRT bundle and interpret it mod Q.
§impl<T> IsSameType<T> for T
impl<T> IsSameType<T> for T
§type EqualityProposition = TrueEqualityProposition
type EqualityProposition = TrueEqualityProposition
The [
EqualityProposition] that Self == T