From 3baeb11a8fbcfcdbc31976d421f17b85503b3ecd Mon Sep 17 00:00:00 2001 From: WuKong Date: Fri, 4 Sep 2015 09:25:34 +0200 Subject: init attribute-based encryption Change-Id: Iba1a3d722110abf747a0fba366f3ebc911d25b25 --- moon-abe/pbc-0.5.14/guru/timefp.c | 98 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 moon-abe/pbc-0.5.14/guru/timefp.c (limited to 'moon-abe/pbc-0.5.14/guru/timefp.c') diff --git a/moon-abe/pbc-0.5.14/guru/timefp.c b/moon-abe/pbc-0.5.14/guru/timefp.c new file mode 100644 index 00000000..6e308f9a --- /dev/null +++ b/moon-abe/pbc-0.5.14/guru/timefp.c @@ -0,0 +1,98 @@ +#include "pbc.h" +#include "pbc_fp.h" +#include "pbc_test.h" + +static void timefield(field_t fp) { + int i, n; + double t0, t1; + + element_t x, y, z; + element_init(x, fp); + element_init(y, fp); + element_init(z, fp); + + element_random(x); + element_random(y); + + n = 20000; + t0 = pbc_get_time(); + for (i=0; i 1) { + mpz_setbit(prime, atoi(argv[1])); + } else { + mpz_setbit(prime, 201); + } + mpz_setbit(prime, 70); + mpz_nextprime(prime, prime); + field_init_mont_fp(f1, prime); + field_init_faster_fp(f2, prime); + + printf("montfp.c\n"); + timefield(f1); + printf("fasterfp.c\n"); + timefield(f2); + + mpz_clear(prime); + field_clear(f1); + field_clear(f2); + return 0; +} -- cgit 1.2.3-korg