MOTION  0.01
Framework for mixed-protocol multi-party computation
Public Member Functions | Static Public Member Functions | List of all members
encrypto::motion::ShareWrapper Class Reference

#include <share_wrapper.h>

Public Member Functions

 ShareWrapper ()
 
 ShareWrapper (const SharePointer &share)
 
 ShareWrapper (const ShareWrapper &sw)
 
void operator= (SharePointer share)
 
void operator= (const ShareWrapper &sw)
 
ShareWrapper operator~ () const
 
ShareWrapper operator^ (const ShareWrapper &other) const
 
ShareWrapperoperator^= (const ShareWrapper &other)
 
ShareWrapper operator& (const ShareWrapper &other) const
 
ShareWrapperoperator&= (const ShareWrapper &other)
 
ShareWrapper operator| (const ShareWrapper &other) const
 
ShareWrapperoperator|= (const ShareWrapper &other)
 
ShareWrapper operator+ (const ShareWrapper &other) const
 
ShareWrapperoperator+= (const ShareWrapper &other)
 
ShareWrapper operator- (const ShareWrapper &other) const
 
ShareWrapperoperator-= (const ShareWrapper &other)
 
ShareWrapper operator* (const ShareWrapper &other) const
 
ShareWrapperoperator*= (const ShareWrapper &other)
 
ShareWrapper operator== (const ShareWrapper &other) const
 
ShareWrapper Mux (const ShareWrapper &a, const ShareWrapper &b) const
 
template<MpcProtocol P>
ShareWrapper Convert () const
 
SharePointerGet ()
 
const SharePointerGet () const
 
const SharePointeroperator* () const
 
const SharePointeroperator-> () const
 
ShareWrapper Out (std::size_t output_owner=std::numeric_limits< std::int64_t >::max()) const
 constructs an output gate, which reconstructs the cleartext result. The default parameter for the output owner corresponds to all parties being the output owners. More...
 
std::vector< ShareWrapperSplit () const
 splits the share into single wires. More...
 
ShareWrapper GetWire (std::size_t i) const
 yields wire #i from share_ as ShareWrapper. More...
 
ShareWrapper Evaluate (const std::shared_ptr< const AlgorithmDescription > &algo) const
 evaluates AlgorithmDescription also on this->share_ as input. More...
 
ShareWrapper Evaluate (const AlgorithmDescription &algo) const
 constructs a circuit from AlgorithmDescription algo and sets this->share_ as input. More...
 
ShareWrapper Subset (std::vector< std::size_t > &&positions)
 constructs a SubsetGate that returns values stored at positions in this->share_. Internally calls ShareWrapper Subset(std::span<std::size_t> positions). More...
 
ShareWrapper Subset (std::span< const std::size_t > positions)
 constructs a SubsetGate that returns values stored at positions in this->share_, e.g., Subset on values {0,1,2} on a share containing l wires with 4 SIMD values each would return all but the last SIMD value on the share while maintaining the number of wires and their order. Repetitions of the positions as well as the number of output SIMD values being greater the the number of the input SIMD values is allowed, e.g., subset of {0,0} of a share with only 1 SIMD value would yield an output share that stores the same value as SIMD twice. More...
 
std::vector< ShareWrapperUnsimdify ()
 constructs an Unsimdify gate with this->share_ as input. UnsimdifyGate decomposes this->share_ into shares with exactly 1 SIMD value, e.g., if this->share_ contained s_0, s_1, and s_2 and SIMD values in this->share_, it will return an std::vector {s_0, s_1, s_2} as separate shares with exactly one SIMD value in each share. More...
 
template<typename T >
As () const
 converts the information on the wires to T. Boolean and arithmetic GMW returns the secret-shared values on the wires. BMR returns "public values", which is also the place where the plaintext results from the output gates is stored. Only conversions to the same format are allowed, e.g., Boolean GMW and BMR to bool, BitVector, or std::vector<BitVector>. Arithmetic GMW shares can only be converted to the same unsigned integer type T that they hold or to std::vector<T>. Converting a Boolean share to (1) bool returns the 0th SIMD value of the 0th wire, (2) BitVector returns all SIMD values on the 0th wire, and (3) std::vector<BitVector> all SIMD values on all wires. More...
 
template<>
bool As () const
 

Static Public Member Functions

static ShareWrapper Concatenate (std::vector< ShareWrapper > &&input)
 concatenates wires in multiple shares in one share. More...
 
static ShareWrapper Concatenate (const std::vector< ShareWrapper >::const_iterator vector_begin, const std::vector< ShareWrapper >::const_iterator vector_end)
 concatenates wires in multiple shares in one share. More...
 
static ShareWrapper Concatenate (std::span< const ShareWrapper > input)
 concatenates wires in multiple shares in one share. Throws if wires have different numbers of SIMD values. More...
 
static ShareWrapper Simdify (std::span< SharePointer > input)
 constructs a SimdifyGate that composes the shares in input into a "larger" share with all the input shares as SIMD values in one share. More...
 
static ShareWrapper Simdify (std::span< const ShareWrapper > input)
 internally extracts shares from each entry in input and calls Simdify(std::span<SharePointer> input) on the result. More...
 
static ShareWrapper Simdify (std::vector< ShareWrapper > &&input)
 internally extracts shares from each entry in input and calls Simdify(std::span<SharePointer> input) on the result. More...
 

Constructor & Destructor Documentation

◆ ShareWrapper() [1/3]

encrypto::motion::ShareWrapper::ShareWrapper ( )
inline
Here is the caller graph for this function:

◆ ShareWrapper() [2/3]

encrypto::motion::ShareWrapper::ShareWrapper ( const SharePointer share)
inline

◆ ShareWrapper() [3/3]

encrypto::motion::ShareWrapper::ShareWrapper ( const ShareWrapper sw)
inline

Member Function Documentation

◆ As() [1/2]

template<typename T >
T encrypto::motion::ShareWrapper::As

converts the information on the wires to T. Boolean and arithmetic GMW returns the secret-shared values on the wires. BMR returns "public values", which is also the place where the plaintext results from the output gates is stored. Only conversions to the same format are allowed, e.g., Boolean GMW and BMR to bool, BitVector, or std::vector<BitVector>. Arithmetic GMW shares can only be converted to the same unsigned integer type T that they hold or to std::vector<T>. Converting a Boolean share to (1) bool returns the 0th SIMD value of the 0th wire, (2) BitVector returns all SIMD values on the 0th wire, and (3) std::vector<BitVector> all SIMD values on all wires.

Here is the caller graph for this function:

◆ As() [2/2]

template<>
template std::vector< std::uint64_t > encrypto::motion::ShareWrapper::As ( ) const

◆ Concatenate() [1/3]

static ShareWrapper encrypto::motion::ShareWrapper::Concatenate ( const std::vector< ShareWrapper >::const_iterator  vector_begin,
const std::vector< ShareWrapper >::const_iterator  vector_end 
)
inlinestatic

concatenates wires in multiple shares in one share.

Exceptions
ifwires have different numbers of SIMD values.
Here is the call graph for this function:

◆ Concatenate() [2/3]

ShareWrapper encrypto::motion::ShareWrapper::Concatenate ( std::span< const ShareWrapper input)
static

concatenates wires in multiple shares in one share. Throws if wires have different numbers of SIMD values.

Here is the call graph for this function:

◆ Concatenate() [3/3]

static ShareWrapper encrypto::motion::ShareWrapper::Concatenate ( std::vector< ShareWrapper > &&  input)
inlinestatic

concatenates wires in multiple shares in one share.

Exceptions
ifwires have different numbers of SIMD values.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Convert()

template<MpcProtocol P>
ShareWrapper encrypto::motion::ShareWrapper::Convert
Here is the caller graph for this function:

◆ Evaluate() [1/2]

ShareWrapper encrypto::motion::ShareWrapper::Evaluate ( const AlgorithmDescription algo) const

constructs a circuit from AlgorithmDescription algo and sets this->share_ as input.

Returns
a share over the output wires of the constructed circuit.
Here is the call graph for this function:

◆ Evaluate() [2/2]

ShareWrapper encrypto::motion::ShareWrapper::Evaluate ( const std::shared_ptr< const AlgorithmDescription > &  algo) const
inline

evaluates AlgorithmDescription also on this->share_ as input.

Returns
the output share of the evaluated circuit as ShareWrapper.
Here is the caller graph for this function:

◆ Get() [1/2]

SharePointer& encrypto::motion::ShareWrapper::Get ( )
inline
Here is the caller graph for this function:

◆ Get() [2/2]

const SharePointer& encrypto::motion::ShareWrapper::Get ( ) const
inline

◆ GetWire()

ShareWrapper encrypto::motion::ShareWrapper::GetWire ( std::size_t  i) const

yields wire #i from share_ as ShareWrapper.

Exceptions
ifi is out of range.
Here is the call graph for this function:

◆ Mux()

ShareWrapper encrypto::motion::ShareWrapper::Mux ( const ShareWrapper a,
const ShareWrapper b 
) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator&()

ShareWrapper encrypto::motion::ShareWrapper::operator& ( const ShareWrapper other) const
Here is the call graph for this function:

◆ operator&=()

ShareWrapper& encrypto::motion::ShareWrapper::operator&= ( const ShareWrapper other)
inline

◆ operator*() [1/2]

const SharePointer& encrypto::motion::ShareWrapper::operator* ( ) const
inline

◆ operator*() [2/2]

ShareWrapper encrypto::motion::ShareWrapper::operator* ( const ShareWrapper other) const

◆ operator*=()

ShareWrapper& encrypto::motion::ShareWrapper::operator*= ( const ShareWrapper other)
inline

◆ operator+()

ShareWrapper encrypto::motion::ShareWrapper::operator+ ( const ShareWrapper other) const

◆ operator+=()

ShareWrapper& encrypto::motion::ShareWrapper::operator+= ( const ShareWrapper other)
inline

◆ operator-()

ShareWrapper encrypto::motion::ShareWrapper::operator- ( const ShareWrapper other) const

◆ operator-=()

ShareWrapper& encrypto::motion::ShareWrapper::operator-= ( const ShareWrapper other)
inline

◆ operator->()

const SharePointer& encrypto::motion::ShareWrapper::operator-> ( ) const
inline

◆ operator=() [1/2]

void encrypto::motion::ShareWrapper::operator= ( const ShareWrapper sw)
inline

◆ operator=() [2/2]

void encrypto::motion::ShareWrapper::operator= ( SharePointer  share)
inline

◆ operator==()

ShareWrapper encrypto::motion::ShareWrapper::operator== ( const ShareWrapper other) const
Here is the call graph for this function:

◆ operator^()

ShareWrapper encrypto::motion::ShareWrapper::operator^ ( const ShareWrapper other) const
Here is the call graph for this function:

◆ operator^=()

ShareWrapper& encrypto::motion::ShareWrapper::operator^= ( const ShareWrapper other)
inline

◆ operator|()

ShareWrapper encrypto::motion::ShareWrapper::operator| ( const ShareWrapper other) const

◆ operator|=()

ShareWrapper& encrypto::motion::ShareWrapper::operator|= ( const ShareWrapper other)
inline

◆ operator~()

ShareWrapper encrypto::motion::ShareWrapper::operator~ ( ) const
Here is the call graph for this function:

◆ Out()

ShareWrapper encrypto::motion::ShareWrapper::Out ( std::size_t  output_owner = std::numeric_limits<std::int64_t>::max()) const

constructs an output gate, which reconstructs the cleartext result. The default parameter for the output owner corresponds to all parties being the output owners.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Simdify() [1/3]

ShareWrapper encrypto::motion::ShareWrapper::Simdify ( std::span< const ShareWrapper input)
static

internally extracts shares from each entry in input and calls Simdify(std::span<SharePointer> input) on the result.

Here is the call graph for this function:

◆ Simdify() [2/3]

ShareWrapper encrypto::motion::ShareWrapper::Simdify ( std::span< SharePointer input)
static

constructs a SimdifyGate that composes the shares in input into a "larger" share with all the input shares as SIMD values in one share.

Exceptions
invalid_argumentthe shares in input are "empty", i.e., contain 0 SIMD values.
invalid_argumentif any of the shares have inconsistent number of wires.
invalid_argumentif any of the shares internally has an inconsistent number of SIMD values across the wires.
Here is the caller graph for this function:

◆ Simdify() [3/3]

ShareWrapper encrypto::motion::ShareWrapper::Simdify ( std::vector< ShareWrapper > &&  input)
static

internally extracts shares from each entry in input and calls Simdify(std::span<SharePointer> input) on the result.

Here is the call graph for this function:

◆ Split()

std::vector< ShareWrapper > encrypto::motion::ShareWrapper::Split ( ) const

splits the share into single wires.

Here is the caller graph for this function:

◆ Subset() [1/2]

ShareWrapper encrypto::motion::ShareWrapper::Subset ( std::span< const std::size_t >  positions)

constructs a SubsetGate that returns values stored at positions in this->share_, e.g., Subset on values {0,1,2} on a share containing l wires with 4 SIMD values each would return all but the last SIMD value on the share while maintaining the number of wires and their order. Repetitions of the positions as well as the number of output SIMD values being greater the the number of the input SIMD values is allowed, e.g., subset of {0,0} of a share with only 1 SIMD value would yield an output share that stores the same value as SIMD twice.

Exceptions
out_of_rangeif at least one of the indices in positions is out of range.
Here is the call graph for this function:

◆ Subset() [2/2]

ShareWrapper encrypto::motion::ShareWrapper::Subset ( std::vector< std::size_t > &&  positions)

constructs a SubsetGate that returns values stored at positions in this->share_. Internally calls ShareWrapper Subset(std::span<std::size_t> positions).

◆ Unsimdify()

std::vector< ShareWrapper > encrypto::motion::ShareWrapper::Unsimdify ( )

constructs an Unsimdify gate with this->share_ as input. UnsimdifyGate decomposes this->share_ into shares with exactly 1 SIMD value, e.g., if this->share_ contained s_0, s_1, and s_2 and SIMD values in this->share_, it will return an std::vector {s_0, s_1, s_2} as separate shares with exactly one SIMD value in each share.

Exceptions
invalid_argumentif any of the shares internally has an inconsistent number of SIMD values across the wires.
invalid_argumentif this->share_ is "empty", i.e., contains 0 SIMD values.

The documentation for this class was generated from the following files: