Fancy

Trait Fancy 

Source
pub trait Fancy {
    type Item: Clone + HasModulus;

    // Required methods
    fn constant(
        &mut self,
        x: u16,
        q: u16,
        channel: &mut Channel<'_>,
    ) -> Result<Self::Item>;
    fn output(
        &mut self,
        x: &Self::Item,
        channel: &mut Channel<'_>,
    ) -> Result<Option<u16>>;

    // Provided method
    fn outputs(
        &mut self,
        xs: &[Self::Item],
        channel: &mut Channel<'_>,
    ) -> Result<Option<Vec<u16>>> { ... }
}
Expand description

DSL for the basic computations supported by fancy-garbling.

Primarily used as a supertrait for FancyBinary and FancyArithmetic, which indicate computation supported by the DSL.

Required Associated Types§

Source

type Item: Clone + HasModulus

The underlying wire datatype created by an object implementing Fancy.

Required Methods§

Source

fn constant( &mut self, x: u16, q: u16, channel: &mut Channel<'_>, ) -> Result<Self::Item>

Create a constant x with modulus q.

Source

fn output( &mut self, x: &Self::Item, channel: &mut Channel<'_>, ) -> Result<Option<u16>>

Process this wire as output. Some Fancy implementers don’t actually return output, but they need to be involved in the process, so they can return None.

Provided Methods§

Source

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

Output a slice of wires.

Implementors§