[−][src]Enum fancy_garbling::Wire
The core wire-label type.
Variants
Mod2
Representation of a mod-2
wire.
Fields of Mod2
Mod3
Representation of a mod-3
wire.
We represent a mod-3
wire by 64 mod-3
elements. These elements are
stored as follows: the least-significant bits of each element are stored
in lsb
and the most-significant bits of each element are stored in
msb
. This representation allows for efficient addition and
multiplication as described here by the paper "Hardware Implementation
of Finite Fields of Characteristic Three." D. Page, N.P. Smart. CHES
2002. Link:
https://link.springer.com/content/pdf/10.1007/3-540-36400-5_38.pdf.
Fields of Mod3
ModN
Representation of a mod-q
wire.
We represent a mod-q
wire for q > 3
by the modulus q
alongside a
list of mod-q
digits.
Fields of ModN
Methods
impl Wire
[src]
pub fn digits(&self) -> Vec<u16>
[src]
Get the digits of the wire.
pub fn from_block(inp: Block, q: u16) -> Self
[src]
Unpack the wire represented by a Block
with modulus q
. Assumes that
the block was constructed through the Wire
API.
pub fn as_block(&self) -> Block
[src]
Pack the wire into a Block
.
pub fn zero(q: u16) -> Self
[src]
The zero wire with modulus q
.
pub fn rand_delta<R: CryptoRng + RngCore>(rng: &mut R, q: u16) -> Self
[src]
Get a random wire label mod q
, with the first digit set to 1
.
pub fn color(&self) -> u16
[src]
Get the color digit of the wire.
pub fn plus(&self, other: &Self) -> Self
[src]
Add two wires digit-wise, returning a new wire.
pub fn plus_eq<'a>(&'a mut self, other: &Wire) -> &'a mut Wire
[src]
Add another wire digit-wise into this one. Assumes that both wires have the same modulus.
pub fn plus_mov(self, other: &Wire) -> Wire
[src]
Add another wire into this one, consuming it for chained computations.
pub fn cmul(&self, c: u16) -> Self
[src]
Multiply each digit by a constant c mod q
, returning a new wire.
pub fn cmul_eq(&mut self, c: u16) -> &mut Wire
[src]
Multiply each digit by a constant c mod q
.
pub fn cmul_mov(self, c: u16) -> Wire
[src]
Multiply each digit by a constant c mod q
, consuming it for chained computations.
pub fn negate(&self) -> Self
[src]
Negate all the digits mod q
, returning a new wire.
pub fn negate_eq(&mut self) -> &mut Wire
[src]
Negate all the digits mod q.
pub fn negate_mov(self) -> Wire
[src]
Negate all the digits mod q
, consuming it for chained computations.
pub fn minus(&self, other: &Wire) -> Wire
[src]
Subtract two wires, returning the result.
pub fn minus_eq<'a>(&'a mut self, other: &Wire) -> &'a mut Wire
[src]
Subtract a wire from this one.
pub fn minus_mov(self, other: &Wire) -> Wire
[src]
Subtract a wire from this one, consuming it for chained computations.
pub fn rand<R: CryptoRng + RngCore>(rng: &mut R, q: u16) -> Wire
[src]
Get a random wire mod q
.
pub fn hash(&self, tweak: Block) -> Block
[src]
Compute the hash of this wire.
Uses fixed-key AES.
pub fn hashback(&self, tweak: Block, q: u16) -> Wire
[src]
Compute the hash of this wire, converting the result back to a wire.
Uses fixed-key AES.
Trait Implementations
impl HasModulus for Wire
[src]
impl PartialEq<Wire> for Wire
[src]
impl Default for Wire
[src]
impl Clone for Wire
[src]
fn clone(&self) -> Wire
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Wire
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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> Clear for T where
T: InitializableFromZeroed + ?Sized,
T: InitializableFromZeroed + ?Sized,
fn clear(&mut self)
impl<T> InitializableFromZeroed for T where
T: Default,
T: Default,
unsafe fn initialize(place: *mut T)
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