aboutsummaryrefslogtreecommitdiffstats
path: root/moon-abe/pbc-0.5.14/guru/exp_test.c
diff options
context:
space:
mode:
authorwukong <rebirthmonkey@gmail.com>2015-11-23 17:48:48 +0100
committerwukong <rebirthmonkey@gmail.com>2015-11-23 17:48:48 +0100
commitfca74d4bc3569506a6659880a89aa009dc11f552 (patch)
tree4cefd06af989608ea8ebd3bc6306889e2a1ad175 /moon-abe/pbc-0.5.14/guru/exp_test.c
parent840ac3ebca7af381132bf7e93c1e4c0430d6b16a (diff)
moon-abe cleanup
Change-Id: Ie1259856db03f0b9e80de3e967ec6bd1f03191b3
Diffstat (limited to 'moon-abe/pbc-0.5.14/guru/exp_test.c')
-rw-r--r--moon-abe/pbc-0.5.14/guru/exp_test.c88
1 files changed, 0 insertions, 88 deletions
diff --git a/moon-abe/pbc-0.5.14/guru/exp_test.c b/moon-abe/pbc-0.5.14/guru/exp_test.c
deleted file mode 100644
index 02ccfaba..00000000
--- a/moon-abe/pbc-0.5.14/guru/exp_test.c
+++ /dev/null
@@ -1,88 +0,0 @@
-// Mutliexponentiation benchmark and test.
-
-#include <string.h>
-#include "pbc.h"
-#include "pbc_test.h"
-
-int main(int argc, char **argv) {
- pairing_t pairing;
- element_t g1, u1, up1, g2, u2, up2, r;
- mpz_t r_mpz;
- element_pp_t g1_pp, g2_pp;
- double t0, t1;
- int i, n;
-
- printf("reading pairing from stdin...\n");
- pbc_demo_pairing_init(pairing, argc, argv);
-
- element_init(r, pairing->Zr);
- element_init(g1, pairing->G1);
- element_init(u1, pairing->G1);
- element_init(up1, pairing->G1);
- element_init(g2, pairing->G2);
- element_init(u2, pairing->G2);
- element_init(up2, pairing->G2);
-
- element_random(r);
- element_random(g1);
- element_random(g2);
-
- mpz_init(r_mpz);
- element_to_mpz(r_mpz, r);
-
- element_pp_init(g1_pp, g1);
- element_pp_init(g2_pp, g2);
-
- n = 100;
- t0 = pbc_get_time();
- for (i=0; i<n; i++) {
- element_pow_mpz(u1, g1, r_mpz);
- }
- t1 = pbc_get_time();
- printf("G1 exp:\t\t%fs\n", t1 - t0);
-
- n = 100;
- t0 = pbc_get_time();
- for (i=0; i<n; i++) {
- element_pow_mpz(u2, g2, r_mpz);
- }
- t1 = pbc_get_time();
- printf("G2 exp:\t\t%fs\n", t1 - t0);
-
- n = 100;
- t0 = pbc_get_time();
- for (i=0; i<n; i++) {
- element_pp_pow(up1, r_mpz, g1_pp);
- }
- t1 = pbc_get_time();
- printf("G1 pp exp:\t%fs\n", t1 - t0);
-
- n = 100;
- t0 = pbc_get_time();
- for (i=0; i<n; i++) {
- element_pp_pow(up2, r_mpz, g2_pp);
- }
- t1 = pbc_get_time();
- printf("G2 pp exp:\t%fs\n", t1 - t0);
-
- if (element_cmp(u1, up1)) {
- printf("Oops 1!\n");
- }
- if (element_cmp(u2, up2)) {
- printf("Oops 2!\n");
- }
-
- mpz_clear(r_mpz);
- element_clear(g1);
- element_clear(u1);
- element_clear(up1);
- element_clear(g2);
- element_clear(u2);
- element_clear(up2);
- element_clear(r);
- element_pp_clear(g1_pp);
- element_pp_clear(g2_pp);
- pairing_clear(pairing);
-
- return 0;
-}