Skip to content

Commit

Permalink
Use command-line modulus with HE-based protocols.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkskeller committed Jun 9, 2020
1 parent 242f3e7 commit d8ad668
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions FHEOffline/PairwiseSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void secure_init(T& setup, Player& P, MachineBase& machine,
machine.drown_sec = sec;
string filename = PREP_DIR + T::name() + "-"
+ to_string(plaintext_length) + "-" + to_string(sec) + "-"
+ OnlineOptions::singleton.prime.get_str() + "-"
+ to_string(CowGearOptions::singleton.top_gear()) + "-P"
+ to_string(P.my_num()) + "-" + to_string(P.num_players());
try
Expand Down
19 changes: 19 additions & 0 deletions Math/Setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,25 @@ void SPDZ_Data_Setup_Primes(bigint& p,int lgp,int& idx,int& m)

void generate_prime(bigint& p, int lgp, int m)
{
if (OnlineOptions::singleton.prime > 0)
{
p = OnlineOptions::singleton.prime;
if (!probPrime(p))
{
cerr << p << " is not a prime" << endl;
exit(1);
}
else if (m != 1 and p % m != 1)
{
cerr << p
<< " is not compatible with our encryption scheme, must be 1 modulo "
<< m << endl;
exit(1);
}
else
return;
}

bigint u;
int ex;
ex = lgp - numBits(m);
Expand Down

0 comments on commit d8ad668

Please sign in to comment.