Trait WireLabel

Source
pub trait WireLabel: Clone + HasModulus {
Show 22 methods // Required methods fn digits(&self) -> Vec<u16>; fn as_block(&self) -> Block; fn color(&self) -> u16; fn plus_eq<'a>(&'a mut self, other: &Self) -> &'a mut Self; fn cmul_eq(&mut self, c: u16) -> &mut Self; fn negate_eq(&mut self) -> &mut Self; fn from_block(inp: Block, q: u16) -> Self; fn zero(q: u16) -> Self; fn rand_delta<R: CryptoRng + Rng>(rng: &mut R, q: u16) -> Self; fn rand<R: CryptoRng + RngCore>(rng: &mut R, q: u16) -> Self; fn hash_to_mod(hash: Block, q: u16) -> Self; // Provided methods fn hashback(&self, tweak: Block, q: u16) -> Self { ... } fn negate_mov(self) -> Self { ... } fn cmul_mov(self, c: u16) -> Self { ... } fn cmul(&self, c: u16) -> Self { ... } fn plus_mov(self, other: &Self) -> Self { ... } fn plus(&self, other: &Self) -> Self { ... } fn negate(&self) -> Self { ... } fn minus_mov(self, other: &Self) -> Self { ... } fn minus(&self, other: &Self) -> Self { ... } fn minus_eq<'a>(&'a mut self, other: &Self) -> &'a mut Self { ... } fn hash(&self, tweak: Block) -> Block { ... }
}
Expand description

Trait implementing a wire that can be used for secure computation via garbled circuits

Required Methods§

Source

fn digits(&self) -> Vec<u16>

Get the digits of the wire

Source

fn as_block(&self) -> Block

Pack the wire into a Block.

Source

fn color(&self) -> u16

Get the color digit of the wire.

Source

fn plus_eq<'a>(&'a mut self, other: &Self) -> &'a mut Self

Add another wire digit-wise into this one. Assumes that both wires have the same modulus.

Source

fn cmul_eq(&mut self, c: u16) -> &mut Self

Multiply each digit by a constant c mod q.

Source

fn negate_eq(&mut self) -> &mut Self

Negate all the digits mod q.

Source

fn from_block(inp: Block, q: u16) -> Self

Pack the wire into a Block.

Source

fn zero(q: u16) -> Self

The zero wire with modulus q

Source

fn rand_delta<R: CryptoRng + Rng>(rng: &mut R, q: u16) -> Self

Get a random wire label mod q, with the first digit set to 1

Source

fn rand<R: CryptoRng + RngCore>(rng: &mut R, q: u16) -> Self

Get a random wire mod q.

Source

fn hash_to_mod(hash: Block, q: u16) -> Self

Subroutine of hashback that converts the hash block into a valid wire of the given modulus. Also useful when batching hashes ahead of time for later conversion.

Provided Methods§

Source

fn hashback(&self, tweak: Block, q: u16) -> Self

Compute the hash of this wire, converting the result back to a wire.

Uses fixed-key AES.

Source

fn negate_mov(self) -> Self

Negate all the digits mod q, consuming it for chained computations.

Source

fn cmul_mov(self, c: u16) -> Self

Multiply each digit by a constant c mod q, consuming it for chained computations.

Source

fn cmul(&self, c: u16) -> Self

Multiply each digit by a constant c mod q, returning a new wire.

Source

fn plus_mov(self, other: &Self) -> Self

Add another wire into this one, consuming it for chained computations.

Source

fn plus(&self, other: &Self) -> Self

Add two wires digit-wise, returning a new wire.

Source

fn negate(&self) -> Self

Negate all the digits mod q, returning a new wire.

Source

fn minus_mov(self, other: &Self) -> Self

Subtract a wire from this one, consuming it for chained computations.

Source

fn minus(&self, other: &Self) -> Self

Subtract two wires, returning the result.

Source

fn minus_eq<'a>(&'a mut self, other: &Self) -> &'a mut Self

Subtract a wire from this one.

Source

fn hash(&self, tweak: Block) -> Block

Compute the hash of this wire.

Uses fixed-key AES.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§