pub trait WireLabel:
Clone
+ HasModulus
+ Add<Output = Self>
+ AddAssign
+ Sub<Output = Self>
+ SubAssign
+ Neg<Output = Self>
+ Mul<u16, Output = Self>
+ MulAssign<u16> {
// Required methods
fn digits(&self) -> Vec<u16>;
fn to_repr(&self) -> U8x16;
fn color(&self) -> u16;
fn from_repr(inp: U8x16, 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: U8x16, q: u16) -> Self;
// Provided methods
fn hashback(&self, tweak: u128, q: u16) -> Self { ... }
fn hash(&self, tweak: u128) -> U8x16 { ... }
}Expand description
A trait that defines a wirelabel as used in garbled circuits.
At its core, a WireLabel is a way of encoding values, and operating on
those encoded values.
Required Methods§
Sourcefn hash_to_mod(hash: U8x16, q: u16) -> Self
fn hash_to_mod(hash: U8x16, q: u16) -> Self
Converts a hashed block into a valid wire of the given modulus q.
This is useful when separately using hash_wires to hash a set of
wires in one shot for efficiency reasons.
§Panics
This panics if q does not align with the modulus supported by the
WireLabel.
Provided Methods§
Sourcefn hashback(&self, tweak: u128, q: u16) -> Self
fn hashback(&self, tweak: u128, q: u16) -> Self
Computes the hash of this WireLabel, converting the result back into
a WireLabel based on the modulus q.
This is equivalent to WireLabel::hash_to_mod(self.hash(tweak), q), and
is useful when stringing together a sequence of operations on a
WireLabel.
§Panics
This panics if q does not align with the modulus supported by the
WireLabel.
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.