forked from data61/MP-SPDZ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CcdShare.h
82 lines (60 loc) · 1.23 KB
/
CcdShare.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* CcdShare.h
*
*/
#ifndef GC_CCDSHARE_H_
#define GC_CCDSHARE_H_
#include "Protocols/ShamirShare.h"
namespace GC
{
template<class T> class CcdSecret;
template<class T>
class CcdShare : public ShamirShare<T>, public ShareSecret<CcdSecret<T>>
{
typedef CcdShare This;
public:
typedef ShamirShare<T> super;
typedef Bit clear;
typedef ReplicatedPrep<This> LivePrep;
typedef ShamirInput<This> Input;
typedef ShamirMC<This> MAC_Check;
typedef Shamir<This> Protocol;
typedef This small_type;
typedef NoShare bit_type;
static const int default_length = 1;
static string name()
{
return "CCD";
}
static MAC_Check* new_mc(typename super::mac_key_type)
{
return new MAC_Check;
}
CcdShare()
{
}
CcdShare(const CcdSecret<T>& other) :
super(other.get_bit(0))
{
}
template<class U>
CcdShare(const U& other) :
super(other)
{
}
void XOR(const This& a, const This& b)
{
*this = a + b;
}
void public_input(bool input)
{
*this = input;
}
This& operator^=(const This& other)
{
*this += other;
return *this;
}
};
}
#endif /* GC_CCDSHARE_H_ */