-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from lducas/all_gates_cmd
finalizing v2.0-alpha
- Loading branch information
Showing
5 changed files
with
97 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include <iostream> | ||
#include <cstdlib> | ||
#include "../FHEW.h" | ||
#include "common.h" | ||
|
||
#include <iostream> | ||
#include <cstdlib> | ||
#include <cassert> | ||
|
||
using namespace std; | ||
|
||
FHEW::EvalKey* EK; | ||
|
||
|
||
void help(char* cmd) { | ||
cerr << "\nusage: " << cmd << " Gate EvalKeyFileName InCTFileName1 InCTFileName2 OutCTFileName \n\n" | ||
<< " Perform Homomorphic Gate computation where Gate={AND, OR, NAND, NOR}\n\n"; | ||
exit(0); | ||
} | ||
|
||
|
||
int main(int argc, char *argv[]) { | ||
if (argc != 6) help(argv[0]); | ||
string gate_n = argv[1]; | ||
char* ek_fn = argv[2]; | ||
char* ict1_fn = argv[3]; | ||
char* ict2_fn = argv[4]; | ||
char* oct_fn = argv[5]; | ||
|
||
BinGate gate; | ||
if (gate_n=="OR") gate = OR; | ||
else if (gate_n=="AND") gate = AND; | ||
else if (gate_n=="NOR") gate = NOR; | ||
else if (gate_n=="NAND") gate = NAND; | ||
else | ||
{ | ||
cerr << "\n This gate does not exists (please choose {AND, OR, NAND, NOR}) \n"; | ||
exit(1); | ||
} | ||
|
||
|
||
|
||
FHEW::Setup(); | ||
|
||
EK = LoadEvalKey(ek_fn); | ||
|
||
LWE::CipherText *ct1,*ct2,*ct3; | ||
|
||
ct1 = LoadCipherText(ict1_fn); | ||
ct2 = LoadCipherText(ict2_fn); | ||
ct3 = new LWE::CipherText; | ||
|
||
|
||
FHEW::HomGate(ct3, gate, *EK,*ct1,*ct2); | ||
|
||
SaveCipherText(ct3,oct_fn); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters