diff --git a/apps/app.cpp b/apps/app.cpp index 576dde40976821c80d0d4fb6eb32475f6c29102f..f4b973c076ff9e3b7f10206490cc5246847ccb20 100644 --- a/apps/app.cpp +++ b/apps/app.cpp @@ -1,7 +1,33 @@ #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 diff --git a/src/ipre.cpp b/src/ipre.cpp index 5396fb29a5f51222309ea6c6b8e70a3f362717e5..47e79ba5601ff48121aaa966b31f83583c1a1835 100644 --- a/src/ipre.cpp +++ b/src/ipre.cpp @@ -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. diff --git a/tests/test_ipre.cpp b/tests/test_ipre.cpp index efbc89794568c92e7319afbe3275082816f356a4..7e0c691c1b7f20bdf50c6e1d5ee425dcfbf9d6ec 100644 --- a/tests/test_ipre.cpp +++ b/tests/test_ipre.cpp @@ -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() {