Skip to content
Snippets Groups Projects
Commit b4f90eee authored by Weiqi's avatar Weiqi
Browse files

Refactor scheme

parent a5531328
Branches
No related tags found
No related merge requests found
#include <iostream>
#include "ipre.h"
using namespace std;
int main() {
cout << "Hello from app." << endl;
cout << "Testing in the app." << endl;
// Init core and setup.
core_init();
pc_param_set_any();
// Testing.
g base, test_value;
gen(base);
g1_mul_dig(test_value, base, 2);
g table[200];
cout << RLC_EP_TABLE_MAX << endl << endl;
g1_mul_pre(table, base);
g1_print(table[0]);
cout << endl;
g1_print(table[1]);
cout << endl;
g1_print(table[2]);
cout << endl;
g1_print(test_value);
cout << endl;
cout << (g1_cmp(table[9], test_value) == RLC_EQ) << endl;
}
\ No newline at end of file
......@@ -58,7 +58,7 @@ int eval(key key, ct x, ct y, int size, int bound) {
gt_inv(ct, ct);
gt_mul(xy, xy, ct);
// Get a G_t element holder.
// Get a target group element holder.
gt output;
// Iterate through a loop to find correct answer.
......
......@@ -2,17 +2,17 @@
int test_scheme() {
// Set x, y vectors.
int x[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 2};
int y[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int x[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
int y[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 1000};
// Initialize the scheme.
key key = setup(10);
// Encrypt the messages.
ct ct_x = enc(key, x, 10);
ct ct_y = enc(key, y, 10);
// Evaluate the two ciphertexts.
int output = eval(key, ct_x, ct_y, 10, 100);
int output = eval(key, ct_x, ct_y, 10, 5000);
return output == 65;
return output == 1045;
}
int main() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment