pub struct Garbler<RNG, Wire> { /* private fields */ }Expand description
Streams garbled circuit ciphertexts through a callback.
Implementations§
Source§impl<RNG: CryptoRng + RngCore, Wire: WireLabel> Garbler<RNG, Wire>
impl<RNG: CryptoRng + RngCore, 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 send_wire(
&mut self,
wire: &Wire,
channel: &mut Channel<'_>,
) -> Result<()>
pub fn send_wire( &mut self, wire: &Wire, channel: &mut Channel<'_>, ) -> Result<()>
Send a wire over the established channel.
Sourcepub fn encode_wire(&mut self, val: u16, modulus: u16) -> (Wire, Wire)
pub fn encode_wire(&mut self, val: u16, modulus: u16) -> (Wire, Wire)
Encode a wire, producing the zero wire as well as the encoded value.
Sourcepub fn encode_many_wires(
&mut self,
vals: &[u16],
moduli: &[u16],
) -> (Vec<Wire>, Vec<Wire>)
pub fn encode_many_wires( &mut self, vals: &[u16], moduli: &[u16], ) -> (Vec<Wire>, Vec<Wire>)
Encode many wires, producing zero wires as well as encoded values.
§Panics
Panics if the length of vals and moduli are not equal.
Sourcepub fn crt_encode_wire(
&mut self,
val: u128,
modulus: u128,
) -> (CrtBundle<Wire>, CrtBundle<Wire>)
pub fn crt_encode_wire( &mut self, val: u128, modulus: u128, ) -> (CrtBundle<Wire>, CrtBundle<Wire>)
Encode a CrtBundle, producing zero wires as well as encoded values.
Sourcepub fn bin_encode_wire(
&mut self,
val: u128,
nbits: usize,
) -> (BinaryBundle<Wire>, BinaryBundle<Wire>)
pub fn bin_encode_wire( &mut self, val: u128, nbits: usize, ) -> (BinaryBundle<Wire>, BinaryBundle<Wire>)
Encode a BinaryBundle, producing zero wires as well as encoded values.
Trait Implementations§
Source§impl<RNG: RngCore + CryptoRng, Wire: WireLabel> Fancy for Garbler<RNG, Wire>
impl<RNG: RngCore + CryptoRng, Wire: WireLabel> Fancy for Garbler<RNG, Wire>
Source§fn constant(
&mut self,
x: u16,
q: u16,
channel: &mut Channel<'_>,
) -> Result<Wire>
fn constant( &mut self, x: u16, q: u16, channel: &mut Channel<'_>, ) -> Result<Wire>
x with modulus q.Source§impl<RNG: RngCore + CryptoRng, Wire: WireLabel + ArithmeticWire> FancyArithmetic for Garbler<RNG, Wire>
impl<RNG: RngCore + CryptoRng, Wire: WireLabel + ArithmeticWire> FancyArithmetic for Garbler<RNG, Wire>
Source§impl<RNG: RngCore + CryptoRng> FancyBinary for Garbler<RNG, AllWire>
impl<RNG: RngCore + 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§fn and(
&mut self,
x: &Self::Item,
y: &Self::Item,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn and( &mut self, x: &Self::Item, y: &Self::Item, channel: &mut Channel<'_>, ) -> Result<Self::Item>
Use binary and_gate
Source§fn or(
&mut self,
x: &Self::Item,
y: &Self::Item,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn or( &mut self, x: &Self::Item, y: &Self::Item, channel: &mut Channel<'_>, ) -> Result<Self::Item>
Source§fn adder(
&mut self,
x: &Self::Item,
y: &Self::Item,
carry_in: Option<&Self::Item>,
channel: &mut Channel<'_>,
) -> Result<(Self::Item, Self::Item)>
fn adder( &mut self, x: &Self::Item, y: &Self::Item, carry_in: Option<&Self::Item>, channel: &mut Channel<'_>, ) -> Result<(Self::Item, Self::Item)>
Source§fn and_many(
&mut self,
args: &[Self::Item],
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn and_many( &mut self, args: &[Self::Item], channel: &mut Channel<'_>, ) -> Result<Self::Item>
Source§fn or_many(
&mut self,
args: &[Self::Item],
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn or_many( &mut self, args: &[Self::Item], channel: &mut Channel<'_>, ) -> Result<Self::Item>
Source§impl<RNG: RngCore + CryptoRng, W: BinaryWireLabel> FancyBinary for Garbler<RNG, W>
impl<RNG: RngCore + 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§fn and(
&mut self,
A: &Self::Item,
B: &Self::Item,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn and( &mut self, A: &Self::Item, B: &Self::Item, channel: &mut Channel<'_>, ) -> Result<Self::Item>
Source§fn or(
&mut self,
x: &Self::Item,
y: &Self::Item,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn or( &mut self, x: &Self::Item, y: &Self::Item, channel: &mut Channel<'_>, ) -> Result<Self::Item>
Source§fn adder(
&mut self,
x: &Self::Item,
y: &Self::Item,
carry_in: Option<&Self::Item>,
channel: &mut Channel<'_>,
) -> Result<(Self::Item, Self::Item)>
fn adder( &mut self, x: &Self::Item, y: &Self::Item, carry_in: Option<&Self::Item>, channel: &mut Channel<'_>, ) -> Result<(Self::Item, Self::Item)>
Source§fn and_many(
&mut self,
args: &[Self::Item],
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn and_many( &mut self, args: &[Self::Item], channel: &mut Channel<'_>, ) -> Result<Self::Item>
Source§fn or_many(
&mut self,
args: &[Self::Item],
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn or_many( &mut self, args: &[Self::Item], channel: &mut Channel<'_>, ) -> Result<Self::Item>
Source§impl<RNG: CryptoRng + RngCore, Wire: WireLabel> FancyInput for Garbler<RNG, Wire>
impl<RNG: CryptoRng + RngCore, Wire: WireLabel> FancyInput 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>>
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>>
Source§fn encode(
&mut self,
value: u16,
modulus: u16,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn encode( &mut self, value: u16, modulus: u16, channel: &mut Channel<'_>, ) -> Result<Self::Item>
Source§fn receive(
&mut self,
modulus: u16,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn receive( &mut self, modulus: u16, channel: &mut Channel<'_>, ) -> Result<Self::Item>
Source§fn encode_bundle(
&mut self,
values: &[u16],
moduli: &[u16],
channel: &mut Channel<'_>,
) -> Result<Bundle<Self::Item>>
fn encode_bundle( &mut self, values: &[u16], moduli: &[u16], channel: &mut Channel<'_>, ) -> Result<Bundle<Self::Item>>
Source§fn receive_bundle(
&mut self,
moduli: &[u16],
channel: &mut Channel<'_>,
) -> Result<Bundle<Self::Item>>
fn receive_bundle( &mut self, moduli: &[u16], channel: &mut Channel<'_>, ) -> Result<Bundle<Self::Item>>
Source§fn encode_bundles(
&mut self,
values: &[Vec<u16>],
moduli: &[Vec<u16>],
channel: &mut Channel<'_>,
) -> Result<Vec<Bundle<Self::Item>>>
fn encode_bundles( &mut self, values: &[Vec<u16>], moduli: &[Vec<u16>], channel: &mut Channel<'_>, ) -> Result<Vec<Bundle<Self::Item>>>
Source§fn receive_many_bundles(
&mut self,
moduli: &[Vec<u16>],
channel: &mut Channel<'_>,
) -> Result<Vec<Bundle<Self::Item>>>
fn receive_many_bundles( &mut self, moduli: &[Vec<u16>], channel: &mut Channel<'_>, ) -> Result<Vec<Bundle<Self::Item>>>
Source§fn crt_encode(
&mut self,
value: u128,
modulus: u128,
channel: &mut Channel<'_>,
) -> Result<CrtBundle<Self::Item>>
fn crt_encode( &mut self, value: u128, modulus: u128, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>>
Source§fn crt_receive(
&mut self,
modulus: u128,
channel: &mut Channel<'_>,
) -> Result<CrtBundle<Self::Item>>
fn crt_receive( &mut self, modulus: u128, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>>
Source§fn crt_encode_many(
&mut self,
values: &[u128],
modulus: u128,
channel: &mut Channel<'_>,
) -> Result<Vec<CrtBundle<Self::Item>>>
fn crt_encode_many( &mut self, values: &[u128], modulus: u128, channel: &mut Channel<'_>, ) -> Result<Vec<CrtBundle<Self::Item>>>
Source§fn crt_receive_many(
&mut self,
n: usize,
modulus: u128,
channel: &mut Channel<'_>,
) -> Result<Vec<CrtBundle<Self::Item>>>
fn crt_receive_many( &mut self, n: usize, modulus: u128, channel: &mut Channel<'_>, ) -> Result<Vec<CrtBundle<Self::Item>>>
Source§fn bin_encode(
&mut self,
value: u128,
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_encode( &mut self, value: u128, nbits: usize, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_receive(
&mut self,
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_receive( &mut self, nbits: usize, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_encode_many(
&mut self,
values: &[u128],
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<Vec<BinaryBundle<Self::Item>>>
fn bin_encode_many( &mut self, values: &[u128], nbits: usize, channel: &mut Channel<'_>, ) -> Result<Vec<BinaryBundle<Self::Item>>>
Source§fn bin_receive_many(
&mut self,
ninputs: usize,
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<Vec<BinaryBundle<Self::Item>>>
fn bin_receive_many( &mut self, ninputs: usize, nbits: usize, channel: &mut Channel<'_>, ) -> Result<Vec<BinaryBundle<Self::Item>>>
Source§impl<RNG: RngCore + CryptoRng, Wire: WireLabel> FancyReveal for Garbler<RNG, Wire>
impl<RNG: RngCore + CryptoRng, Wire: WireLabel> FancyReveal for Garbler<RNG, Wire>
Source§fn reveal(&mut self, x: &Wire, channel: &mut Channel<'_>) -> Result<u16>
fn reveal(&mut self, x: &Wire, channel: &mut Channel<'_>) -> Result<u16>
x to all parties.Source§fn reveal_many(
&mut self,
xs: &[Self::Item],
channel: &mut Channel<'_>,
) -> Result<Vec<u16>>
fn reveal_many( &mut self, xs: &[Self::Item], channel: &mut Channel<'_>, ) -> Result<Vec<u16>>
Source§fn reveal_bundle(
&mut self,
x: &Bundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Vec<u16>>
fn reveal_bundle( &mut self, x: &Bundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Vec<u16>>
Source§fn reveal_many_bundles(
&mut self,
xs: &[Bundle<Self::Item>],
channel: &mut Channel<'_>,
) -> Result<Vec<Vec<u16>>>
fn reveal_many_bundles( &mut self, xs: &[Bundle<Self::Item>], channel: &mut Channel<'_>, ) -> Result<Vec<Vec<u16>>>
Source§fn crt_reveal(
&mut self,
x: &CrtBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<u128>
fn crt_reveal( &mut self, x: &CrtBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<u128>
Source§fn crt_reveal_many(
&mut self,
xs: &[CrtBundle<Self::Item>],
channel: &mut Channel<'_>,
) -> Result<Vec<u128>>
fn crt_reveal_many( &mut self, xs: &[CrtBundle<Self::Item>], channel: &mut Channel<'_>, ) -> Result<Vec<u128>>
Source§fn bin_reveal(
&mut self,
x: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<u128>
fn bin_reveal( &mut self, x: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<u128>
Source§fn bin_reveal_many(
&mut self,
xs: &[BinaryBundle<Self::Item>],
channel: &mut Channel<'_>,
) -> Result<Vec<u128>>
fn bin_reveal_many( &mut self, xs: &[BinaryBundle<Self::Item>], channel: &mut Channel<'_>, ) -> Result<Vec<u128>>
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> UnwindSafe for Garbler<RNG, Wire>where
Wire: UnwindSafe,
RNG: UnwindSafe,
Blanket Implementations§
Source§impl<F> ArithmeticBundleGadgets for Fwhere
F: FancyArithmetic,
impl<F> ArithmeticBundleGadgets for Fwhere
F: FancyArithmetic,
Source§fn add_bundles(
&mut self,
x: &Bundle<Self::Item>,
y: &Bundle<Self::Item>,
) -> Bundle<Self::Item>
fn add_bundles( &mut self, x: &Bundle<Self::Item>, y: &Bundle<Self::Item>, ) -> Bundle<Self::Item>
Source§fn sub_bundles(
&mut self,
x: &Bundle<Self::Item>,
y: &Bundle<Self::Item>,
) -> Bundle<Self::Item>
fn sub_bundles( &mut self, x: &Bundle<Self::Item>, y: &Bundle<Self::Item>, ) -> Bundle<Self::Item>
Source§fn mul_bundles(
&mut self,
x: &Bundle<Self::Item>,
y: &Bundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Bundle<Self::Item>>
fn mul_bundles( &mut self, x: &Bundle<Self::Item>, y: &Bundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Bundle<Self::Item>>
Source§fn mixed_radix_addition(
&mut self,
xs: &[Bundle<Self::Item>],
channel: &mut Channel<'_>,
) -> Result<Bundle<Self::Item>>
fn mixed_radix_addition( &mut self, xs: &[Bundle<Self::Item>], channel: &mut Channel<'_>, ) -> Result<Bundle<Self::Item>>
Source§fn mixed_radix_addition_msb_only(
&mut self,
xs: &[Bundle<Self::Item>],
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn mixed_radix_addition_msb_only( &mut self, xs: &[Bundle<Self::Item>], channel: &mut Channel<'_>, ) -> Result<Self::Item>
Source§impl<F> BinaryBundleGadgets for Fwhere
F: FancyBinary,
impl<F> BinaryBundleGadgets for Fwhere
F: FancyBinary,
Source§impl<F> BinaryGadgets for Fwhere
F: FancyBinary,
impl<F> BinaryGadgets for Fwhere
F: FancyBinary,
Source§fn bin_constant_bundle(
&mut self,
val: u128,
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_constant_bundle( &mut self, val: u128, nbits: usize, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_output(
&mut self,
x: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Option<u128>>
fn bin_output( &mut self, x: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Option<u128>>
u128.Source§fn bin_outputs(
&mut self,
xs: &[BinaryBundle<Self::Item>],
channel: &mut Channel<'_>,
) -> Result<Option<Vec<u128>>>
fn bin_outputs( &mut self, xs: &[BinaryBundle<Self::Item>], channel: &mut Channel<'_>, ) -> Result<Option<Vec<u128>>>
u128.Source§fn bin_xor(
&mut self,
x: &BinaryBundle<Self::Item>,
y: &BinaryBundle<Self::Item>,
) -> BinaryBundle<Self::Item>
fn bin_xor( &mut self, x: &BinaryBundle<Self::Item>, y: &BinaryBundle<Self::Item>, ) -> BinaryBundle<Self::Item>
Source§fn bin_and(
&mut self,
x: &BinaryBundle<Self::Item>,
y: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_and( &mut self, x: &BinaryBundle<Self::Item>, y: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_or(
&mut self,
x: &BinaryBundle<Self::Item>,
y: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_or( &mut self, x: &BinaryBundle<Self::Item>, y: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_addition(
&mut self,
xs: &BinaryBundle<Self::Item>,
ys: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<(BinaryBundle<Self::Item>, Self::Item)>
fn bin_addition( &mut self, xs: &BinaryBundle<Self::Item>, ys: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<(BinaryBundle<Self::Item>, Self::Item)>
Source§fn bin_addition_no_carry(
&mut self,
xs: &BinaryBundle<Self::Item>,
ys: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_addition_no_carry( &mut self, xs: &BinaryBundle<Self::Item>, ys: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_multiplication_lower_half(
&mut self,
xs: &BinaryBundle<Self::Item>,
ys: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_multiplication_lower_half( &mut self, xs: &BinaryBundle<Self::Item>, ys: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_mul(
&mut self,
xs: &BinaryBundle<Self::Item>,
ys: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_mul( &mut self, xs: &BinaryBundle<Self::Item>, ys: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_div(
&mut self,
xs: &BinaryBundle<Self::Item>,
ys: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_div( &mut self, xs: &BinaryBundle<Self::Item>, ys: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_twos_complement(
&mut self,
xs: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_twos_complement( &mut self, xs: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_subtraction(
&mut self,
xs: &BinaryBundle<Self::Item>,
ys: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<(BinaryBundle<Self::Item>, Self::Item)>
fn bin_subtraction( &mut self, xs: &BinaryBundle<Self::Item>, ys: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<(BinaryBundle<Self::Item>, Self::Item)>
Source§fn bin_multiplex_constant_bits(
&mut self,
x: &Self::Item,
c1: u128,
c2: u128,
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_multiplex_constant_bits( &mut self, x: &Self::Item, c1: u128, c2: u128, nbits: usize, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
x=0 return c1 as a bundle of constant bits, else return c2.Source§fn bin_multiplex(
&mut self,
b: &Self::Item,
x: &BinaryBundle<Self::Item>,
y: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_multiplex( &mut self, b: &Self::Item, x: &BinaryBundle<Self::Item>, y: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_cmul(
&mut self,
x: &BinaryBundle<Self::Item>,
c: u128,
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_cmul( &mut self, x: &BinaryBundle<Self::Item>, c: u128, nbits: usize, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_abs(
&mut self,
x: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_abs( &mut self, x: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_lt_signed(
&mut self,
x: &BinaryBundle<Self::Item>,
y: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn bin_lt_signed( &mut self, x: &BinaryBundle<Self::Item>, y: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Self::Item>
x < y (signed version)Source§fn bin_lt(
&mut self,
x: &BinaryBundle<Self::Item>,
y: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn bin_lt( &mut self, x: &BinaryBundle<Self::Item>, y: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Self::Item>
x < y.Source§fn bin_geq(
&mut self,
x: &BinaryBundle<Self::Item>,
y: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn bin_geq( &mut self, x: &BinaryBundle<Self::Item>, y: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Self::Item>
x >= y.Source§fn bin_max(
&mut self,
xs: &[BinaryBundle<Self::Item>],
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_max( &mut self, xs: &[BinaryBundle<Self::Item>], channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
xs. Read moreSource§fn bin_demux(
&mut self,
x: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Vec<Self::Item>>
fn bin_demux( &mut self, x: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Vec<Self::Item>>
Source§fn bin_rsa(
&mut self,
x: &BinaryBundle<Self::Item>,
c: usize,
) -> BinaryBundle<Self::Item>
fn bin_rsa( &mut self, x: &BinaryBundle<Self::Item>, c: usize, ) -> BinaryBundle<Self::Item>
Source§fn bin_rsl(
&mut self,
x: &BinaryBundle<Self::Item>,
c: usize,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_rsl( &mut self, x: &BinaryBundle<Self::Item>, c: usize, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Source§fn bin_shr(
&mut self,
x: &BinaryBundle<Self::Item>,
c: usize,
pad: &Self::Item,
) -> BinaryBundle<Self::Item>
fn bin_shr( &mut self, x: &BinaryBundle<Self::Item>, c: usize, pad: &Self::Item, ) -> BinaryBundle<Self::Item>
padSource§fn bin_eq_bundles(
&mut self,
x: &BinaryBundle<Self::Item>,
y: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn bin_eq_bundles( &mut self, x: &BinaryBundle<Self::Item>, y: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Self::Item>
x == y for binary bundles.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
Source§impl<F> BundleGadgets for Fwhere
F: Fancy,
impl<F> BundleGadgets for Fwhere
F: Fancy,
Source§fn constant_bundle(
&mut self,
xs: &[u16],
ps: &[u16],
channel: &mut Channel<'_>,
) -> Result<Bundle<Self::Item>>
fn constant_bundle( &mut self, xs: &[u16], ps: &[u16], channel: &mut Channel<'_>, ) -> Result<Bundle<Self::Item>>
ps.Source§fn output_bundle(
&mut self,
x: &Bundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Option<Vec<u16>>>
fn output_bundle( &mut self, x: &Bundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Option<Vec<u16>>>
Source§fn output_bundles(
&mut self,
xs: &[Bundle<Self::Item>],
channel: &mut Channel<'_>,
) -> Result<Option<Vec<Vec<u16>>>>
fn output_bundles( &mut self, xs: &[Bundle<Self::Item>], channel: &mut Channel<'_>, ) -> Result<Option<Vec<Vec<u16>>>>
Source§impl<F> CrtGadgets for Fwhere
F: FancyArithmetic + FancyBinary,
impl<F> CrtGadgets for Fwhere
F: FancyArithmetic + FancyBinary,
Source§fn crt_constant_bundle(
&mut self,
x: u128,
q: u128,
channel: &mut Channel<'_>,
) -> Result<CrtBundle<Self::Item>>
fn crt_constant_bundle( &mut self, x: u128, q: u128, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>>
x under
composite modulus q.Source§fn crt_output(
&mut self,
x: &CrtBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Option<u128>>
fn crt_output( &mut self, x: &CrtBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Option<u128>>
Source§fn crt_outputs(
&mut self,
xs: &[CrtBundle<Self::Item>],
channel: &mut Channel<'_>,
) -> Result<Option<Vec<u128>>>
fn crt_outputs( &mut self, xs: &[CrtBundle<Self::Item>], channel: &mut Channel<'_>, ) -> Result<Option<Vec<u128>>>
Source§fn crt_add(
&mut self,
x: &CrtBundle<Self::Item>,
y: &CrtBundle<Self::Item>,
) -> CrtBundle<Self::Item>
fn crt_add( &mut self, x: &CrtBundle<Self::Item>, y: &CrtBundle<Self::Item>, ) -> CrtBundle<Self::Item>
Source§fn crt_sub(
&mut self,
x: &CrtBundle<Self::Item>,
y: &CrtBundle<Self::Item>,
) -> CrtBundle<Self::Item>
fn crt_sub( &mut self, x: &CrtBundle<Self::Item>, y: &CrtBundle<Self::Item>, ) -> CrtBundle<Self::Item>
Source§fn crt_cmul(
&mut self,
x: &CrtBundle<Self::Item>,
c: u128,
) -> CrtBundle<Self::Item>
fn crt_cmul( &mut self, x: &CrtBundle<Self::Item>, c: u128, ) -> CrtBundle<Self::Item>
x by the corresponding residue of c.Source§fn crt_mul(
&mut self,
x: &CrtBundle<Self::Item>,
y: &CrtBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<CrtBundle<Self::Item>>
fn crt_mul( &mut self, x: &CrtBundle<Self::Item>, y: &CrtBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>>
x with y.Source§fn crt_cexp(
&mut self,
x: &CrtBundle<Self::Item>,
c: u16,
channel: &mut Channel<'_>,
) -> Result<CrtBundle<Self::Item>>
fn crt_cexp( &mut self, x: &CrtBundle<Self::Item>, c: u16, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>>
x by the constant c.Source§fn crt_rem(
&mut self,
x: &CrtBundle<Self::Item>,
p: u16,
channel: &mut Channel<'_>,
) -> Result<CrtBundle<Self::Item>>
fn crt_rem( &mut self, x: &CrtBundle<Self::Item>, p: u16, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>>
p. Read moreSource§fn crt_fractional_mixed_radix(
&mut self,
bun: &CrtBundle<Self::Item>,
ms: &[u16],
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn crt_fractional_mixed_radix( &mut self, bun: &CrtBundle<Self::Item>, ms: &[u16], channel: &mut Channel<'_>, ) -> Result<Self::Item>
X/M where M=product(ms).Source§fn crt_relu(
&mut self,
x: &CrtBundle<Self::Item>,
accuracy: &str,
output_moduli: Option<&[u16]>,
channel: &mut Channel<'_>,
) -> Result<CrtBundle<Self::Item>>
fn crt_relu( &mut self, x: &CrtBundle<Self::Item>, accuracy: &str, output_moduli: Option<&[u16]>, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>>
max(x,0). Read moreSource§fn crt_sign(
&mut self,
x: &CrtBundle<Self::Item>,
accuracy: &str,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn crt_sign( &mut self, x: &CrtBundle<Self::Item>, accuracy: &str, channel: &mut Channel<'_>, ) -> Result<Self::Item>
x is positive and 1 if x is negative.Source§fn crt_sgn(
&mut self,
x: &CrtBundle<Self::Item>,
accuracy: &str,
output_moduli: Option<&[u16]>,
channel: &mut Channel<'_>,
) -> Result<CrtBundle<Self::Item>>
fn crt_sgn( &mut self, x: &CrtBundle<Self::Item>, accuracy: &str, output_moduli: Option<&[u16]>, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>>
Source§fn crt_lt(
&mut self,
x: &CrtBundle<Self::Item>,
y: &CrtBundle<Self::Item>,
accuracy: &str,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn crt_lt( &mut self, x: &CrtBundle<Self::Item>, y: &CrtBundle<Self::Item>, accuracy: &str, channel: &mut Channel<'_>, ) -> Result<Self::Item>
x < y.Source§fn crt_geq(
&mut self,
x: &CrtBundle<Self::Item>,
y: &CrtBundle<Self::Item>,
accuracy: &str,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn crt_geq( &mut self, x: &CrtBundle<Self::Item>, y: &CrtBundle<Self::Item>, accuracy: &str, channel: &mut Channel<'_>, ) -> Result<Self::Item>
x >= y.Source§fn crt_max(
&mut self,
xs: &[CrtBundle<Self::Item>],
accuracy: &str,
channel: &mut Channel<'_>,
) -> Result<CrtBundle<Self::Item>>
fn crt_max( &mut self, xs: &[CrtBundle<Self::Item>], accuracy: &str, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>>
xs. Read moreSource§fn crt_to_pmr(
&mut self,
xs: &CrtBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Bundle<Self::Item>>
fn crt_to_pmr( &mut self, xs: &CrtBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Bundle<Self::Item>>
Source§fn pmr_lt(
&mut self,
x: &CrtBundle<Self::Item>,
y: &CrtBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn pmr_lt( &mut self, x: &CrtBundle<Self::Item>, y: &CrtBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Self::Item>
Source§fn pmr_geq(
&mut self,
x: &CrtBundle<Self::Item>,
y: &CrtBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Self::Item>
fn pmr_geq( &mut self, x: &CrtBundle<Self::Item>, y: &CrtBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Self::Item>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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§impl<T> IsSameType<T> for T
impl<T> IsSameType<T> for T
§type EqualityProposition = TrueEqualityProposition
type EqualityProposition = TrueEqualityProposition
EqualityProposition] that Self == T