diff options
Diffstat (limited to 'moon-abe/pbc-0.5.14/pbc/pairing_test.pbc')
-rw-r--r-- | moon-abe/pbc-0.5.14/pbc/pairing_test.pbc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/moon-abe/pbc-0.5.14/pbc/pairing_test.pbc b/moon-abe/pbc-0.5.14/pbc/pairing_test.pbc new file mode 100644 index 00000000..c57189f7 --- /dev/null +++ b/moon-abe/pbc-0.5.14/pbc/pairing_test.pbc @@ -0,0 +1,21 @@ +# Tests sample type A pairing. + +g := G1([2382389466570123849673299401984867521337122094157231907755149435707124249269394670242462497382963719723036281844079382411446883273020125104982896098602669, 2152768906589770702756591740710760107878949212304343787392475836859241438597588807103470081101790991563152395601123682809718038151417122294066319979967168]); + +h := G2([5832612417453786541700129157230442590988122495898645678468800815872828277169950107203266157735206975228912899931278160262081308603240860553459187732968543, 5825590786822892934138376868455818413990615826926356662470129700411774690868351658310187202553513693344017463065909279569624651155563430675084173630054336]); + +a := 171583727262251826931173602797951212789946235851; +b := 233634857565210859330459959563397971304462340857; + +CHECK(pairing(g, h) == GT([1352478452661998164151215014828915385601138645645403926287105573769451214277485326392786454433874957123922454604362337349978217917242114505658729401276644, 2809858014072341042857607405424304552357466023841122154308055820747972163307396014445308786731013691659356362568425895483877936945589613445697089590886519])); + +CHECK(g^a == G1([3727290142167731134589933003026410141163353118002821914170365887139605219852868537686435214464927363733592858325260588072422405672197113236445369761687270, 8313413520789037477320458888316489483781506373846006723006557775349684878102042826049292521482530556981023752851151672326421296204733037418468523296005577])); + +CHECK(h^b == G2([302169045606583472168811217560382970305157511680176350745436990853463473855962841196184541109617397027480204774682450915021848512168573082843355648090809, 7428193877404140917518137438384425427600294220905786853638038223349096573857683866658575603565175187399696035468569929483731011292133989973187846752806084])); + +res := GT([5401677742232403160612802517983583823254857216272776607059355607024091426935935872461700304196658606704085604766577186374528948004140797833341187234647180, 4255900207739859478558185000995524505026245539159946661271849714832846423204570340979120001638894488614502770175520505048836617405342161594891740961421000]); + +CHECK(res == pairing(g^a, h^b)); +CHECK(res == pairing(g, h)^(Zr(a)*Zr(b))); +CHECK(res == pairing(g^a, h)^b); +CHECK(res == pairing(g, h^b)^a); |