pub struct GarbledCircuit { /* private fields */ }Expand description
A garbled circuit.
A garbled circuit at its core is just a vector of garbled rows and constant wirelabels.
Implementations§
Source§impl GarbledCircuit
impl GarbledCircuit
Sourcepub fn new(blocks: Vec<U8x16>) -> Self
pub fn new(blocks: Vec<U8x16>) -> Self
Create a GarbledCircuit from a vector of garbled rows and constant
wirelabels.
Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
The number of garbled rows and constant wires in the garbled circuit.
Sourcepub fn garble<Wire: WireLabel, Circuit: EvaluableCircuit<Garbler<RNG, Wire>>, RNG: CryptoRng + RngCore>(
c: &Circuit,
rng: RNG,
) -> Result<(Encoder<Wire>, Self, OutputMapping)>
pub fn garble<Wire: WireLabel, Circuit: EvaluableCircuit<Garbler<RNG, Wire>>, RNG: CryptoRng + RngCore>( c: &Circuit, rng: RNG, ) -> Result<(Encoder<Wire>, Self, OutputMapping)>
Garble a circuit.
This outputs three things:
- An
Encoderfor encoding inputs to valid input wirelabels. - The garbled circuit itself.
- An
OutputMappingmapping for mapping output wirelabels to their associated underlying values.
Sourcepub fn eval<Wire: WireLabel, Circuit: EvaluableCircuit<Evaluator<Wire>>>(
&self,
c: &Circuit,
garbler_inputs: &[Wire],
evaluator_inputs: &[Wire],
) -> Result<Vec<u16>>
pub fn eval<Wire: WireLabel, Circuit: EvaluableCircuit<Evaluator<Wire>>>( &self, c: &Circuit, garbler_inputs: &[Wire], evaluator_inputs: &[Wire], ) -> Result<Vec<u16>>
Evaluate the garbled circuit on the provided inputs.
Sourcepub fn eval_to_wirelabels<Wire: WireLabel, Circuit: EvaluableCircuit<Evaluator<Wire>>>(
&self,
c: &Circuit,
garbler_inputs: &[Wire],
evaluator_inputs: &[Wire],
) -> Result<Vec<Wire>>
pub fn eval_to_wirelabels<Wire: WireLabel, Circuit: EvaluableCircuit<Evaluator<Wire>>>( &self, c: &Circuit, garbler_inputs: &[Wire], evaluator_inputs: &[Wire], ) -> Result<Vec<Wire>>
Evaluate the garbled circuit on the provided inputs, returning the output wirelabels.
Trait Implementations§
Source§impl Debug for GarbledCircuit
impl Debug for GarbledCircuit
Source§impl<'de> Deserialize<'de> for GarbledCircuit
impl<'de> Deserialize<'de> for GarbledCircuit
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&GarbledCircuit> for GarbledChannel
impl From<&GarbledCircuit> for GarbledChannel
Source§fn from(value: &GarbledCircuit) -> Self
fn from(value: &GarbledCircuit) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for GarbledCircuit
impl RefUnwindSafe for GarbledCircuit
impl Send for GarbledCircuit
impl Sync for GarbledCircuit
impl Unpin for GarbledCircuit
impl UnwindSafe for GarbledCircuit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IsSameType<T> for T
impl<T> IsSameType<T> for T
§type EqualityProposition = TrueEqualityProposition
type EqualityProposition = TrueEqualityProposition
The [
EqualityProposition] that Self == T