python - How to set order of pairing groups in Charm crypto -


i trying implement scheme using charm crypto framework. need limit order of pairing groups. mentioned in docs pairing groups of prime order p. there way set , retrieve order of group?

here initialization code:

from charm.toolbox.pairinggroup import pairinggroup,zr,g1,g2,gt,pair group = pairinggroup('ss512') # way limit order of group. g= group.random(g1)  

you cannot arbitrarily limit order of group, because statically defined. changing order result in wrong math. see pairingcurves.py actual curve/group definitions.

charm doesn't provide api randomly generate groups. have use other means. can define own bilinear group different types of pairings (a, a1, d, e, f, g) , load through file path:

group = pairinggroup('path/to/your.curve', param_file=true) 

it tricky find curve, task shouldn't taken lightly. or use existing curve fits needs, need fit definition pbc framework syntax. alternatively, try use miracl or relic groups.

the bilinear group known ss512 has order of 159 bits, can generate sized group jpbc this:

typeacurvegenerator acg = new typeacurvegenerator(159, 512); system.out.println(acg.generate().tostring()); 

if question using composite pairings in charm, possible, (all?) schemes use composite pairings work without change in prime-order pairing groups. since charm prototyping framework, sort of acceptable.

if want composite-order pairings, need use type a1 pairings (in pbc terms). here randomly generated 3 prime composite-order pairing 512 bits:

 type a1 p 1670989300461616676020115835196624302572015979741737622588414172392006868526486484884570321557721963197638289051694226860029659217040445686227725866093025893199423787713616626672757609704165197428442342008003828808450677009862027725351326816526944993760066091035498153554504093779461048411316013603195971067672308536313762529018467620342707812387949408799890849708954393542918305728285021157211449323969172048055050509532384121122664412498844071023691473088832866379 n 609850109657524334313910888757892081230662766329101322112559916931389368075360030979770190349533563210816893814486944109499875626657096965776542286895264924525337148800590009734583069235096787382643190513870010514033093799219718147938440443987936129109513171910765749472446749554547827887341610804086120827617630852669256397451995481876900661455455988613098850258742479395225659024921540568325346468601887608779215514427877416468125697992278858037843603317092287 n0 8505241857674726137023630400543607424307642763093227742803963199629609197431754602210402024133058838940680654387728383432014899362154746576168888879287087 n1 6728838950500080306008250663471535622833113558890962570274290389468902237095474435002792009761303551917673603722453122814539738669387524716830981925740419 n2 10656051345714616867334012480608522414320097962876120231224626211497062700168731928194215198773439101914013339645791513272716800476458903122389271111043579 l 2740 

this generated following code through jpbc:

typea1curvegenerator a1 = new typea1curvegenerator(3, 512); system.out.println(a1.generate().tostring()); 

use @ own peril.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -