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/pbc/bilinear.test | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 moon-abe/pbc-0.5.14/pbc/bilinear.test (limited to 'moon-abe/pbc-0.5.14/pbc/bilinear.test') diff --git a/moon-abe/pbc-0.5.14/pbc/bilinear.test b/moon-abe/pbc-0.5.14/pbc/bilinear.test new file mode 100644 index 00000000..956c792e --- /dev/null +++ b/moon-abe/pbc-0.5.14/pbc/bilinear.test @@ -0,0 +1,50 @@ +define test_element_order(group) { + a := random(group); + o := order(group); + b := a^o; + CHECK(b == group(0)); +} + +define test_group_order() { + CHECK(order(G1) == order(G2)); + CHECK(order(G2) == order(GT)); + a := pairing(random(G1), random(G2)); + o := order(GT); + b := a^o; + CHECK(b == GT(0)); +} + +define test_pairing_with_zero() { + CHECK(GT(0) == GT(1)); + CHECK(pairing(G1(0), random(G2)) == GT(0)); + CHECK(pairing(random(G1), G2(0)) == GT(0)); + CHECK(pairing(G1(0), G2(0)) == GT(0)); +} + +define test_bilinear() { + a1 := random(G1); + b1 := random(G2); + x := random(Zr); + y := random(Zr); + CHECK(pairing(a1^x, b1) == pairing(a1, b1^x)); + CHECK(pairing(a1^x, b1) == pairing(a1, b1)^x); + CHECK(pairing(a1, b1^x) == pairing(a1, b1)^x); + CHECK(pairing(a1^x, b1^y) == pairing(a1, b1)^(x*y)); +} + +define test(initfn) { + initfn(); + test_element_order(G1); + test_element_order(G2); + test_element_order(GT); + test_group_order(); + test_pairing_with_zero(); + test_bilinear(); +} + +test(init_pairing_a); +test(init_pairing_d); +test(init_pairing_e); +test(init_pairing_f); +test(init_pairing_g); +test(init_pairing_i); -- cgit 1.2.3-korg