Commit 30cbd3f8 authored by yiwenshao's avatar yiwenshao

add bench_pailliar

parent 8c5e06bf
...@@ -29,18 +29,27 @@ test_pailliar(int num_of_tests) { ...@@ -29,18 +29,27 @@ test_pailliar(int num_of_tests) {
ZZ pt0 = NTL::to_ZZ(1); ZZ pt0 = NTL::to_ZZ(1);
ZZ enc0; ZZ enc0;
timer t;
for(int i=0;i<num_of_tests;i++){ for(int i=0;i<num_of_tests;i++){
enc0 = sk->encrypt(pt0); enc0 = sk->encrypt(pt0);
} }
std::cout<<"enc_pailliar_in_us: "<<t.lap()*1.0/num_of_tests<<std::endl;
for(int i=0;i<num_of_tests;i++){ for(int i=0;i<num_of_tests;i++){
const ZZ dec0 = sk->decrypt(enc0); const ZZ dec0 = sk->decrypt(enc0);
} }
std::cout<<"dec_pailliar_in_us: "<<t.lap()*1.0/num_of_tests<<std::endl;
} }
int int
main(int argc,char**argv) { main(int argc,char**argv) {
test_pailliar(100); int num_of_tests = 10000;
if(argc==2){
num_of_tests = std::stoi(std::string(argv[1]));
}else{
std::cout<<"num_of_tests"<<std::endl;
return 0;
}
test_pailliar(num_of_tests);
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment