[−][src]Struct fancy_garbling::informer::Informer
Implements Fancy
. Used to learn information about a Fancy
computation in
a lightweight way.
Methods
impl Informer
[src]
pub fn new() -> Informer
[src]
Make a new Informer
.
pub fn print_info(&self)
[src]
Print information about the fancy computation.
For example, below is the output when run on circuits/AES-non-expanded.txt
:
computation info: garbler inputs: 128 // comms cost: 16 Kb evaluator inputs: 128 // comms cost: 48 Kb reused values: 12 outputs: 128 output ciphertexts: 256 // comms cost: 32 Kb constants: 1 // comms cost: 0.125 Kb additions: 25124 subtractions: 1692 cmuls: 0 projections: 0 multiplications: 6800 ciphertexts: 13600 // comms cost: 1.66 Mb (1700.00 Kb) total comms cost: 1.75 Mb // 1700.00 Kb
pub fn num_garbler_inputs(&self) -> usize
[src]
Number of garbler inputs in the fancy computation.
pub fn garbler_input_moduli(&self) -> Vec<u16>
[src]
Moduli of garbler inputs in the fancy computation.
pub fn num_evaluator_inputs(&self) -> usize
[src]
Number of evaluator inputs in the fancy computation.
pub fn evaluator_input_moduli(&self) -> Vec<u16>
[src]
Moduli of evaluator inputs in the fancy computation.
pub fn num_consts(&self) -> usize
[src]
Number of constants in the fancy computation.
pub fn num_outputs(&self) -> usize
[src]
Number of outputs in the fancy computation.
pub fn num_output_ciphertexts(&self) -> usize
[src]
Number of output ciphertexts.
pub fn num_adds(&self) -> usize
[src]
Number of additions in the fancy computation.
pub fn num_subs(&self) -> usize
[src]
Number of subtractions in the fancy computation.
pub fn num_cmuls(&self) -> usize
[src]
Number of scalar multiplications in the fancy computation.
pub fn num_muls(&self) -> usize
[src]
Number of multiplications in the fancy computation.
pub fn num_projs(&self) -> usize
[src]
Number of projections in the fancy computation.
pub fn num_ciphertexts(&self) -> usize
[src]
Number of ciphertexts in the fancy computation.
Trait Implementations
impl FancyInput for Informer
[src]
fn receive(&mut self, modulus: u16) -> Result<Self::Item, Self::Error>
[src]
fn encode(
&mut self,
_value: u16,
modulus: u16
) -> Result<Self::Item, Self::Error>
[src]
&mut self,
_value: u16,
modulus: u16
) -> Result<Self::Item, Self::Error>
fn receive_many(
&mut self,
moduli: &[u16]
) -> Result<Vec<Self::Item>, Self::Error>
[src]
&mut self,
moduli: &[u16]
) -> Result<Vec<Self::Item>, Self::Error>
fn encode_many(
&mut self,
_values: &[u16],
moduli: &[u16]
) -> Result<Vec<Self::Item>, Self::Error>
[src]
&mut self,
_values: &[u16],
moduli: &[u16]
) -> Result<Vec<Self::Item>, Self::Error>
fn encode_bundle(
&mut self,
values: &[u16],
moduli: &[u16]
) -> Result<Bundle<Self::Item>, Self::Error>
[src]
&mut self,
values: &[u16],
moduli: &[u16]
) -> Result<Bundle<Self::Item>, Self::Error>
Encode a bundle.
fn receive_bundle(
&mut self,
moduli: &[u16]
) -> Result<Bundle<Self::Item>, Self::Error>
[src]
&mut self,
moduli: &[u16]
) -> Result<Bundle<Self::Item>, Self::Error>
Receive a bundle.
fn encode_bundles(
&mut self,
values: &[Vec<u16>],
moduli: &[Vec<u16>]
) -> Result<Vec<Bundle<Self::Item>>, Self::Error>
[src]
&mut self,
values: &[Vec<u16>],
moduli: &[Vec<u16>]
) -> Result<Vec<Bundle<Self::Item>>, Self::Error>
Encode many input bundles.
fn receive_many_bundles(
&mut self,
moduli: &[Vec<u16>]
) -> Result<Vec<Bundle<Self::Item>>, Self::Error>
[src]
&mut self,
moduli: &[Vec<u16>]
) -> Result<Vec<Bundle<Self::Item>>, Self::Error>
Receive many input bundles.
fn crt_encode(
&mut self,
value: u128,
modulus: u128
) -> Result<CrtBundle<Self::Item>, Self::Error>
[src]
&mut self,
value: u128,
modulus: u128
) -> Result<CrtBundle<Self::Item>, Self::Error>
Encode a CRT input bundle.
fn crt_receive(
&mut self,
modulus: u128
) -> Result<CrtBundle<Self::Item>, Self::Error>
[src]
&mut self,
modulus: u128
) -> Result<CrtBundle<Self::Item>, Self::Error>
Receive an CRT input bundle.
fn crt_encode_many(
&mut self,
values: &[u128],
modulus: u128
) -> Result<Vec<CrtBundle<Self::Item>>, Self::Error>
[src]
&mut self,
values: &[u128],
modulus: u128
) -> Result<Vec<CrtBundle<Self::Item>>, Self::Error>
Encode many CRT input bundles.
fn crt_receive_many(
&mut self,
n: usize,
modulus: u128
) -> Result<Vec<CrtBundle<Self::Item>>, Self::Error>
[src]
&mut self,
n: usize,
modulus: u128
) -> Result<Vec<CrtBundle<Self::Item>>, Self::Error>
Receive many CRT input bundles.
fn bin_encode(
&mut self,
value: u128,
nbits: usize
) -> Result<BinaryBundle<Self::Item>, Self::Error>
[src]
&mut self,
value: u128,
nbits: usize
) -> Result<BinaryBundle<Self::Item>, Self::Error>
Encode a binary input bundle.
fn bin_receive(
&mut self,
nbits: usize
) -> Result<BinaryBundle<Self::Item>, Self::Error>
[src]
&mut self,
nbits: usize
) -> Result<BinaryBundle<Self::Item>, Self::Error>
Receive an binary input bundle.
fn bin_encode_many(
&mut self,
values: &[u128],
nbits: usize
) -> Result<Vec<BinaryBundle<Self::Item>>, Self::Error>
[src]
&mut self,
values: &[u128],
nbits: usize
) -> Result<Vec<BinaryBundle<Self::Item>>, Self::Error>
Encode many binary input bundles.
fn bin_receive_many(
&mut self,
ninputs: usize,
nbits: usize
) -> Result<Vec<BinaryBundle<Self::Item>>, Self::Error>
[src]
&mut self,
ninputs: usize,
nbits: usize
) -> Result<Vec<BinaryBundle<Self::Item>>, Self::Error>
Receive many binary input bundles.
impl Fancy for Informer
[src]
type Item = InformerVal
The underlying wire datatype created by an object implementing Fancy
.
type Error = InformerError
Errors which may be thrown by the users of Fancy.
fn constant(&mut self, val: u16, q: u16) -> Result<InformerVal, InformerError>
[src]
fn add(
&mut self,
x: &InformerVal,
y: &InformerVal
) -> Result<InformerVal, InformerError>
[src]
&mut self,
x: &InformerVal,
y: &InformerVal
) -> Result<InformerVal, InformerError>
fn sub(
&mut self,
x: &InformerVal,
y: &InformerVal
) -> Result<InformerVal, InformerError>
[src]
&mut self,
x: &InformerVal,
y: &InformerVal
) -> Result<InformerVal, InformerError>
fn cmul(
&mut self,
x: &InformerVal,
_: u16
) -> Result<InformerVal, InformerError>
[src]
&mut self,
x: &InformerVal,
_: u16
) -> Result<InformerVal, InformerError>
fn mul(
&mut self,
x: &InformerVal,
y: &InformerVal
) -> Result<InformerVal, InformerError>
[src]
&mut self,
x: &InformerVal,
y: &InformerVal
) -> Result<InformerVal, InformerError>
fn proj(
&mut self,
x: &InformerVal,
q: u16,
_: Option<Vec<u16>>
) -> Result<InformerVal, InformerError>
[src]
&mut self,
x: &InformerVal,
q: u16,
_: Option<Vec<u16>>
) -> Result<InformerVal, InformerError>
fn output(&mut self, x: &InformerVal) -> Result<(), InformerError>
[src]
fn add_many(&mut self, args: &[Self::Item]) -> Result<Self::Item, Self::Error>
[src]
Sum up a slice of wires.
fn xor(
&mut self,
x: &Self::Item,
y: &Self::Item
) -> Result<Self::Item, Self::Error>
[src]
&mut self,
x: &Self::Item,
y: &Self::Item
) -> Result<Self::Item, Self::Error>
Xor is just addition, with the requirement that x
and y
are mod 2.
fn negate(&mut self, x: &Self::Item) -> Result<Self::Item, Self::Error>
[src]
Negate by xoring x
with 1
.
fn and(
&mut self,
x: &Self::Item,
y: &Self::Item
) -> Result<Self::Item, Self::Error>
[src]
&mut self,
x: &Self::Item,
y: &Self::Item
) -> Result<Self::Item, Self::Error>
And is just multiplication, with the requirement that x
and y
are mod 2.
fn or(
&mut self,
x: &Self::Item,
y: &Self::Item
) -> Result<Self::Item, Self::Error>
[src]
&mut self,
x: &Self::Item,
y: &Self::Item
) -> Result<Self::Item, Self::Error>
Or uses Demorgan's Rule implemented with multiplication and negation.
fn and_many(&mut self, args: &[Self::Item]) -> Result<Self::Item, Self::Error>
[src]
Returns 1 if all wires equal 1.
fn or_many(&mut self, args: &[Self::Item]) -> Result<Self::Item, Self::Error>
[src]
Returns 1 if any wire equals 1.
fn mod_change(
&mut self,
x: &Self::Item,
to_modulus: u16
) -> Result<Self::Item, Self::Error>
[src]
&mut self,
x: &Self::Item,
to_modulus: u16
) -> Result<Self::Item, Self::Error>
Change the modulus of x
to to_modulus
using a projection gate.
fn adder(
&mut self,
x: &Self::Item,
y: &Self::Item,
carry_in: Option<&Self::Item>
) -> Result<(Self::Item, Self::Item), Self::Error>
[src]
&mut self,
x: &Self::Item,
y: &Self::Item,
carry_in: Option<&Self::Item>
) -> Result<(Self::Item, Self::Item), Self::Error>
Binary adder. Returns the result and the carry.
fn mux(
&mut self,
b: &Self::Item,
x: &Self::Item,
y: &Self::Item
) -> Result<Self::Item, Self::Error>
[src]
&mut self,
b: &Self::Item,
x: &Self::Item,
y: &Self::Item
) -> Result<Self::Item, Self::Error>
If b = 0
returns x
else y
. Read more
fn mux_constant_bits(
&mut self,
x: &Self::Item,
b1: bool,
b2: bool
) -> Result<Self::Item, Self::Error>
[src]
&mut self,
x: &Self::Item,
b1: bool,
b2: bool
) -> Result<Self::Item, Self::Error>
If x = 0
returns the constant b1
else return b2
. Folds constants if possible.
fn outputs(&mut self, xs: &[Self::Item]) -> Result<(), Self::Error>
[src]
Output a slice of wires.
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, U> IntoBits<U> for T where
U: FromBits<T>,
U: FromBits<T>,
fn into_bits(self) -> U
impl<T> FromCast<T> for T
fn from_cast(t: T) -> T
impl<T, U> Cast<U> for T where
U: FromCast<T>,
U: FromCast<T>,
fn cast(self) -> U
impl<T> FromBits<T> for T
fn from_bits(t: T) -> T
impl<T> Same<T> for T
type Output = T
Should always be Self