/* * Rep3Share.h * */ #ifndef MATH_REP3SHARE_H_ #define MATH_REP3SHARE_H_ #include "Math/FixedVec.h" #include "Math/Integer.h" #include "Processor/Replicated.h" template class Rep3Share : public FixedVec { public: typedef T clear; typedef T open_type; typedef T mac_type; typedef T mac_key_type; typedef Replicated Protocol; typedef ReplicatedMC MAC_Check; typedef MAC_Check Direct_MC; typedef ReplicatedInput Input; typedef ReplicatedPrivateOutput PrivateOutput; const static bool needs_ot = false; static string type_short() { return "R" + string(1, clear::type_char()); } static string type_string() { return "replicated " + T::type_string(); } Rep3Share() { } Rep3Share(const FixedVec& other) { FixedVec::operator=(other); } Rep3Share(T value, int my_num) { Replicated::assign(*this, value, my_num); } // Share compatibility void assign(clear other, int my_num, const T& alphai) { (void)alphai; *this = Rep3Share(other, my_num); } void assign(const char* buffer) { FixedVec::assign(buffer); } void add(const Rep3Share& x, const Rep3Share& y) { *this = x + y; } void sub(const Rep3Share& x, const Rep3Share& y) { *this = x - y; } void add(const Rep3Share& S, const clear aa, int my_num, const T& alphai) { (void)alphai; *this = S + Rep3Share(aa, my_num); } void sub(const Rep3Share& S, const clear& aa, int my_num, const T& alphai) { (void)alphai; *this = S - Rep3Share(aa, my_num); } void sub(const clear& aa, const Rep3Share& S, int my_num, const T& alphai) { (void)alphai; *this = Rep3Share(aa, my_num) - S; } clear local_mul(const Rep3Share& other) const { return (*this)[0] * other.sum() + (*this)[1] * other[0]; } void mul_by_bit(const Rep3Share& x, const T& y) { (void) x, (void) y; throw not_implemented(); } void pack(octetStream& os, bool full = true) const { (void)full; FixedVec::pack(os); } void unpack(octetStream& os, bool full = true) { (void)full; FixedVec::unpack(os); } }; #endif /* MATH_REP3SHARE_H_ */