[][src]Struct fancy_garbling::dummy::Dummy

pub struct Dummy { /* fields omitted */ }

Simple struct that performs the fancy computation over u16.

Methods

impl Dummy[src]

pub fn new() -> Dummy[src]

Create a new Dummy.

pub fn get_output(self) -> Vec<u16>[src]

Get the output from the fancy computation, consuming the Dummy.

Trait Implementations

impl FancyInput for Dummy[src]

fn encode(&mut self, value: u16, modulus: u16) -> Result<DummyVal, DummyError>[src]

Encode a single dummy value.

fn encode_many(
    &mut self,
    xs: &[u16],
    moduli: &[u16]
) -> Result<Vec<DummyVal>, DummyError>
[src]

Encode a slice of inputs and a slice of moduli as DummyVals.

fn receive(&mut self, modulus: u16) -> Result<Self::Item, Self::Error>[src]

Receive a single value.

fn encode_bundle(
    &mut self,
    values: &[u16],
    moduli: &[u16]
) -> Result<Bundle<Self::Item>, Self::Error>
[src]

Encode a bundle.

fn receive_bundle(
    &mut self,
    moduli: &[u16]
) -> Result<Bundle<Self::Item>, Self::Error>
[src]

Receive a bundle.

fn encode_bundles(
    &mut self,
    values: &[Vec<u16>],
    moduli: &[Vec<u16>]
) -> Result<Vec<Bundle<Self::Item>>, Self::Error>
[src]

Encode many input bundles.

fn receive_many_bundles(
    &mut self,
    moduli: &[Vec<u16>]
) -> Result<Vec<Bundle<Self::Item>>, Self::Error>
[src]

Receive many input bundles.

fn crt_encode(
    &mut self,
    value: u128,
    modulus: u128
) -> Result<CrtBundle<Self::Item>, Self::Error>
[src]

Encode a CRT input bundle.

fn crt_receive(
    &mut self,
    modulus: u128
) -> Result<CrtBundle<Self::Item>, Self::Error>
[src]

Receive an CRT input bundle.

fn crt_encode_many(
    &mut self,
    values: &[u128],
    modulus: u128
) -> Result<Vec<CrtBundle<Self::Item>>, Self::Error>
[src]

Encode many CRT input bundles.

fn crt_receive_many(
    &mut self,
    n: usize,
    modulus: u128
) -> Result<Vec<CrtBundle<Self::Item>>, Self::Error>
[src]

Receive many CRT input bundles.

fn bin_encode(
    &mut self,
    value: u128,
    nbits: usize
) -> Result<BinaryBundle<Self::Item>, Self::Error>
[src]

Encode a binary input bundle.

fn bin_receive(
    &mut self,
    nbits: usize
) -> Result<BinaryBundle<Self::Item>, Self::Error>
[src]

Receive an binary input bundle.

fn bin_encode_many(
    &mut self,
    values: &[u128],
    nbits: usize
) -> Result<Vec<BinaryBundle<Self::Item>>, Self::Error>
[src]

Encode many binary input bundles.

fn bin_receive_many(
    &mut self,
    ninputs: usize,
    nbits: usize
) -> Result<Vec<BinaryBundle<Self::Item>>, Self::Error>
[src]

Receive many binary input bundles.

impl Fancy for Dummy[src]

type Item = DummyVal

The underlying wire datatype created by an object implementing Fancy.

type Error = DummyError

Errors which may be thrown by the users of Fancy.

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]

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]

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]

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]

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]

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]

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]

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

impl Send for Dummy

impl Sync for Dummy

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> IntoBits<U> for T where
    U: FromBits<T>, 

impl<T> FromCast<T> for T

impl<T, U> Cast<U> for T where
    U: FromCast<T>, 

impl<T> FromBits<T> for T

impl<T> Same<T> for T

type Output = T

Should always be Self