forked from data61/MP-SPDZ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimpleDistDecrypt.cpp
46 lines (37 loc) · 940 Bytes
/
SimpleDistDecrypt.cpp
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
/*
* SimpleDistDecrypt.cpp
*
*/
#include <FHEOffline/SimpleDistDecrypt.h>
template <class FD>
void SimpleDistDecrypt<FD>::intermediate_step()
{
for (unsigned int i = 0; i < this->vv.size(); i++)
this->vv[i] += this->f.coeff(i);
}
template <class FD>
void SimpleDistDecrypt<FD>::reshare(Plaintext<typename FD::T, FD, typename FD::S>& m,
const Ciphertext& cm,
EncCommitBase<typename FD::T, FD, typename FD::S>& EC)
{
(void)EC;
m = reshare(cm);
}
template <class FD>
Plaintext_<FD> SimpleDistDecrypt<FD>::reshare(const Ciphertext& cm)
{
PRNG G;
G.ReSeed();
this->f.randomize(G, Full);
// Step 3
this->run(cm);
// Step 4
Plaintext_<FD> m(this->f.get_field());
if (this->P.my_num()==0)
{ sub(m,this->mf,this->f); }
else
{ m=this->f; m.negate(); }
return m;
}
template class SimpleDistDecrypt<FFT_Data>;
template class SimpleDistDecrypt<P2Data>;