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§
Sourcefn plus_eq<'a>(&'a mut self, other: &Self) -> &'a mut Self
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.
Sourcefn from_block(inp: Block, q: u16) -> Self
fn from_block(inp: Block, q: u16) -> Self
Pack the wire into a Block.
Sourcefn rand_delta<R: CryptoRng + Rng>(rng: &mut R, q: u16) -> Self
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
Sourcefn hash_to_mod(hash: Block, q: u16) -> Self
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§
Sourcefn hashback(&self, tweak: Block, q: u16) -> Self
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.
Sourcefn negate_mov(self) -> Self
fn negate_mov(self) -> Self
Negate all the digits mod q, consuming it for chained computations.
Sourcefn cmul_mov(self, c: u16) -> Self
fn cmul_mov(self, c: u16) -> Self
Multiply each digit by a constant c mod q, consuming it for chained computations.
Sourcefn cmul(&self, c: u16) -> Self
fn cmul(&self, c: u16) -> Self
Multiply each digit by a constant c mod q, returning a new wire.
Sourcefn plus_mov(self, other: &Self) -> Self
fn plus_mov(self, other: &Self) -> Self
Add another wire into this one, consuming it for chained computations.
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.