Implementing Bilinear Pairing in java using jPBC -


i tried implement bilinear pairing in java using jpbc, , check bilinearity property using following code. correct? dont know how know if correct or not. please help.

     pairingfactory.getinstance().setusepbcwhenpossible(true);     pairing pairing = pairingfactory.getpairing("f:\\try\\params\\curves\\a.properties");    int degree = pairing.getdegree();    system.out.println("degree = "+ degree);      /* return zr */     field zr = pairing.getzr();      /* return g1 */     field g1 = pairing.getg1();      /* return g2 */     field g2 = pairing.getg2();      /* return gt */     field gt = pairing.getgt();      element u = g1.newrandomelement();      element v = g2.newrandomelement();      element e1 = pairing.pairing(u, v); //pairing can computed      system.out.println("element u = "+ u);     system.out.println("element v = "+ v);     system.out.println("pairing e(u,v) = "+ e1);       //check bilinearity property of bilinear-pairing     // e( u^a , v^b ) = e(u,v)^(a*b)     element = zr.newrandomelement();     element b = zr.newrandomelement();      system.out.println("element = "+ a);     system.out.println("element b = "+ b);      element lhs = pairing.pairing(u.powzn(a), v.powzn(b));     element rhs = e1.powzn(a.mul(b));      system.out.println("lhs = "+lhs);     system.out.println("rhs = "+rhs);      if(lhs.isequal(rhs))     {         system.out.println("bilinear");     }     else     {         system.out.println("not bilinear");     } 

and output is

degree = 2 element u = 4866041342894402677803693405130010832349339992236773091903579144194363002203438055317050262465150164708359404800429625278583966038535861732618064981597588,2520129541588537942227591395792708348477737843963482402959590033554670903024187404197414712797505861725822220731358101319943167983180677145528408822293587,0 element v = 6529258305528540310250832226812328115955374264752957892339595921573477787820817174021465903363097848161094331714483348574944223486909340975642036873512616,3691480837121382500601782418389559456783070610647315982199609076044168554795955799987737829489239176417326640138311078114124128153650566676808890301518470,0 pairing e(u,v) = {x=7680797668329937815088420850270374629509382249103994006581639961464198477062710179129546441620215742476345389500469950463014995069256898530079394630800905,y=4381713099922646676896241268471865978284848986483823691187964242279854012615948775464846659757919737326079688679266942570087087450470377987737389535849010} element = 393845971301072953348418011317340085945313299952 element b = 87466036726809504477215126720848633203781454447 lhs = {x=3098294361406206064115429913268673069433256494954089884628823190592635636111566932396144131395192369872555728858136558844620669431467808470302071809950199,y=5813928251188210989466471963926842747815078174548948204704296203413728702115252887863505105608557349187188341013964975053787442451645922266533731535114150} rhs = {x=3098294361406206064115429913268673069433256494954089884628823190592635636111566932396144131395192369872555728858136558844620669431467808470302071809950199,y=5813928251188210989466471963926842747815078174548948204704296203413728702115252887863505105608557349187188341013964975053787442451645922266533731535114150} bilinear 

yes, correct way implement bilinear pairing using jpbc library : element g = pairing.pairing(q1,q2);

there exists no such checks verify answer correct way of implementation.


Comments