How to use copytext method in pyatom

Best Python code snippet using pyatom_python

config64.py

Source:config64.py Github

copy

Full Screen

1import os2import sys3deltext=""4slashtext=""5copytext=""6if sys.platform.startswith("darwin") :7 copytext="cp "8 deltext="rm "9 slashtext="/"10if sys.platform.startswith("linux") :11 copytext="cp "12 deltext="rm "13 slashtext="/"14if sys.platform.startswith("win") :15 copytext="copy "16 deltext="del "17 slashtext="\\"18chosen=[]19cptr=020def replace(namefile,oldtext,newtext):21 f = open(namefile,'r')22 filedata = f.read()23 f.close()24 newdata = filedata.replace(oldtext,newtext)25 f = open(namefile,'w')26 f.write(newdata)27 f.close()28def rsaset(tb,nb,base,ml) :29 global deltext,slashtext,copytext30 global cptr,chosen31 chosen.append(tb)32 cptr=cptr+133 fpath="amcl"+slashtext+tb+slashtext34 os.system("mkdir amcl"+slashtext+tb)35 os.system(copytext+"ARCH64.go "+fpath+"ARCH.go")36 os.system(copytext+"BIG64.go "+fpath+"BIG.go")37 os.system(copytext+"DBIG.go "+fpath+"DBIG.go")38 os.system(copytext+"FF64.go "+fpath+"FF.go")39 os.system(copytext+"RSA.go "+fpath+"RSA.go")40 os.system(copytext+"CONFIG_BIG.go "+fpath+"CONFIG_BIG.go")41 os.system(copytext+"CONFIG_FF.go "+fpath+"CONFIG_FF.go")42 replace(fpath+"ARCH.go","XXX",tb)43 replace(fpath+"CONFIG_BIG.go","XXX",tb)44 replace(fpath+"CONFIG_FF.go","XXX",tb)45 replace(fpath+"BIG.go","XXX",tb)46 replace(fpath+"DBIG.go","XXX",tb)47 replace(fpath+"FF.go","XXX",tb)48 replace(fpath+"RSA.go","XXX",tb)49 replace(fpath+"CONFIG_BIG.go","@NB@",nb)50 replace(fpath+"CONFIG_BIG.go","@BASE@",base)51 replace(fpath+"CONFIG_FF.go","@ML@",ml);52def curveset(tc,nb,base,nbt,m8,mt,ct,pf,stw,sx,ab,cs) :53 global deltext,slashtext,copytext54 global cptr,chosen55 chosen.append(tc)56 cptr=cptr+157 fpath="amcl"+slashtext+tc+slashtext58 os.system("mkdir amcl"+slashtext+tc)59 os.system(copytext+"ARCH64.go "+fpath+"ARCH.go")60 os.system(copytext+"BIG64.go "+fpath+"BIG.go")61 os.system(copytext+"DBIG.go "+fpath+"DBIG.go")62 os.system(copytext+"FP.go "+fpath+"FP.go")63 os.system(copytext+"ECP.go "+fpath+"ECP.go")64 os.system(copytext+"ECDH.go "+fpath+"ECDH.go")65 os.system(copytext+"CONFIG_BIG.go "+fpath+"CONFIG_BIG.go")66 os.system(copytext+"CONFIG_FIELD.go "+fpath+"CONFIG_FIELD.go")67 os.system(copytext+"CONFIG_CURVE.go "+fpath+"CONFIG_CURVE.go")68 os.system(copytext+"ROM_"+tc+"_64.go "+fpath+"ROM.go")69 replace(fpath+"ARCH.go","XXX",tc)70 replace(fpath+"BIG.go","XXX",tc)71 replace(fpath+"DBIG.go","XXX",tc)72 replace(fpath+"FP.go","XXX",tc)73 replace(fpath+"ECP.go","XXX",tc)74 replace(fpath+"ECDH.go","XXX",tc)75 replace(fpath+"CONFIG_BIG.go","XXX",tc)76 replace(fpath+"CONFIG_FIELD.go","XXX",tc)77 replace(fpath+"CONFIG_CURVE.go","XXX",tc)78 replace(fpath+"CONFIG_BIG.go","@NB@",nb)79 replace(fpath+"CONFIG_BIG.go","@BASE@",base)80 replace(fpath+"CONFIG_FIELD.go","@NBT@",nbt)81 replace(fpath+"CONFIG_FIELD.go","@M8@",m8)82 replace(fpath+"CONFIG_FIELD.go","@MT@",mt)83 ib=int(base)84 inb=int(nb)85 inbt=int(nbt)86 sh=ib*(1+((8*inb-1)//ib))-inbt87 if sh > 30 :88 sh=3089 replace(fpath+"CONFIG_FIELD.go","@SH@",str(sh))90 replace(fpath+"CONFIG_CURVE.go","@CT@",ct)91 replace(fpath+"CONFIG_CURVE.go","@PF@",pf)92 replace(fpath+"CONFIG_CURVE.go","@ST@",stw)93 replace(fpath+"CONFIG_CURVE.go","@SX@",sx)94 replace(fpath+"CONFIG_CURVE.go","@AB@",ab)95 if cs == "128" :96 replace(fpath+"CONFIG_CURVE.go","@HT@","32")97 replace(fpath+"CONFIG_CURVE.go","@AK@","16")98 if cs == "192" :99 replace(fpath+"CONFIG_CURVE.go","@HT@","48")100 replace(fpath+"CONFIG_CURVE.go","@AK@","24")101 if cs == "256" :102 replace(fpath+"CONFIG_CURVE.go","@HT@","64")103 replace(fpath+"CONFIG_CURVE.go","@AK@","32")104 if pf != "NOT" :105 os.system(copytext+"FP2.go "+fpath+"FP2.go")106 os.system(copytext+"FP4.go "+fpath+"FP4.go")107 replace(fpath+"FP2.go","XXX",tc)108 replace(fpath+"FP4.go","XXX",tc)109 110 if cs == "128" :111 os.system(copytext+"ECP2.go "+fpath+"ECP2.go")112 os.system(copytext+"FP12.go "+fpath+"FP12.go")113 os.system(copytext+"PAIR.go "+fpath+"PAIR.go")114 os.system(copytext+"MPIN.go "+fpath+"MPIN.go")115 os.system(copytext+"BLS.go "+fpath+"BLS.go")116 replace(fpath+"FP12.go","XXX",tc)117 replace(fpath+"ECP2.go","XXX",tc)118 replace(fpath+"PAIR.go","XXX",tc)119 replace(fpath+"MPIN.go","XXX",tc)120 replace(fpath+"BLS.go","XXX",tc)121 if cs == "192" :122 os.system(copytext+"FP24.go "+fpath+"FP24.go")123 os.system(copytext+"FP8.go "+fpath+"FP8.go")124 os.system(copytext+"ECP4.go "+fpath+"ECP4.go")125 os.system(copytext+"PAIR192.go "+fpath+"PAIR192.go")126 os.system(copytext+"MPIN192.go "+fpath+"MPIN192.go")127 os.system(copytext+"BLS192.go "+fpath+"BLS192.go")128 replace(fpath+"FP24.go","XXX",tc)129 replace(fpath+"FP8.go","XXX",tc)130 replace(fpath+"ECP4.go","XXX",tc)131 replace(fpath+"PAIR192.go","XXX",tc)132 replace(fpath+"MPIN192.go","XXX",tc)133 replace(fpath+"BLS192.go","XXX",tc)134 if cs == "256" :135 os.system(copytext+"FP48.go "+fpath+"FP48.go")136 os.system(copytext+"FP16.go "+fpath+"FP16.go")137 os.system(copytext+"FP8.go "+fpath+"FP8.go")138 os.system(copytext+"ECP8.go "+fpath+"ECP8.go")139 os.system(copytext+"PAIR256.go "+fpath+"PAIR256.go")140 os.system(copytext+"MPIN256.go "+fpath+"MPIN256.go")141 os.system(copytext+"BLS256.go "+fpath+"BLS256.go")142 replace(fpath+"FP48.go","XXX",tc)143 replace(fpath+"FP16.go","XXX",tc)144 replace(fpath+"FP8.go","XXX",tc)145 replace(fpath+"ECP8.go","XXX",tc)146 replace(fpath+"PAIR256.go","XXX",tc)147 replace(fpath+"MPIN256.go","XXX",tc)148 replace(fpath+"BLS256.go","XXX",tc)149os.system("mkdir amcl")150os.system(copytext+ "HASH*.go amcl"+slashtext+".")151os.system(copytext+ "SHA3.go amcl"+slashtext+".")152os.system(copytext+ "RAND.go amcl"+slashtext+".")153os.system(copytext+ "AES.go amcl"+slashtext+".")154os.system(copytext+ "GCM.go amcl"+slashtext+".")155os.system(copytext+ "NHS.go amcl"+slashtext+".")156print("Elliptic Curves")157print("1. ED25519")158print("2. C25519")159print("3. NIST256")160print("4. BRAINPOOL")161print("5. ANSSI")162print("6. HIFIVE")163print("7. GOLDILOCKS")164print("8. NIST384")165print("9. C41417")166print("10. NIST521\n")167print("11. NUMS256W")168print("12. NUMS256E")169print("13. NUMS384W")170print("14. NUMS384E")171print("15. NUMS512W")172print("16. NUMS512E")173print("17. SECP256K1\n")174print("Pairing-Friendly Elliptic Curves")175print("18. BN254")176print("19. BN254CX")177print("20. BLS383")178print("21. BLS381")179print("22. FP256BN")180print("23. FP512BN")181print("24. BLS461\n")182print("25. BLS24")183print("26. BLS48\n")184print("RSA")185print("27. RSA2048")186print("28. RSA3072")187print("29. RSA4096")188selection=[]189ptr=0190max=30191curve_selected=False192pfcurve_selected=False193rsa_selected=False194while ptr<max:195 x=int(input("Choose a Scheme to support - 0 to finish: "))196 if x == 0:197 break198# print("Choice= ",x)199 already=False200 for i in range(0,ptr):201 if x==selection[i]:202 already=True203 break204 if already:205 continue206 selection.append(x)207 ptr=ptr+1208# curveset(big,field,curve,big_length_bytes,bits_in_base,modulus_bits,modulus_mod_8,modulus_type,curve_type,pairing_friendly,sextic twist,sign of x,ate bits,curve security)209# where "curve" is the common name for the elliptic curve210# big_length_bytes is the modulus size rounded up to a number of bytes211# bits_in_base gives the number base used for 64 bit architectures, as n where the base is 2^n212# modulus_bits is the actual bit length of the modulus.213# modulus_mod_8 is the remainder when the modulus is divided by 8214# modulus_type is NOT_SPECIAL, or PSEUDO_MERSENNE, or MONTGOMERY_Friendly, or GENERALISED_MERSENNE (supported for GOLDILOCKS only)215# curve_type is WEIERSTRASS, EDWARDS or MONTGOMERY216# pairing_friendly is BN, BLS or NOT (if not pairing friendly217# ate bits is number of bits in Ate parameter (from romgen program)218# curve security is AES equiavlent, rounded up.219 if x==1:220 curveset("ED25519","32","56","255","5","PSEUDO_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","128")221 curve_selected=True222 if x==2:223 curveset("C25519","32","56","255","5","PSEUDO_MERSENNE","MONTGOMERY","NOT","NOT","NOT","NOT","128")224 curve_selected=True225 if x==3:226 curveset("NIST256","32","56","256","7","NOT_SPECIAL","WEIERSTRASS","NOT","NOT","NOT","NOT","128")227 curve_selected=True228 if x==4:229 curveset("BRAINPOOL","32","56","256","7","NOT_SPECIAL","WEIERSTRASS","NOT","NOT","NOT","NOT","128")230 curve_selected=True231 if x==5:232 curveset("ANSSI","32","56","256","7","NOT_SPECIAL","WEIERSTRASS","NOT","NOT","NOT","NOT","128")233 curve_selected=True234 if x==6:235 curveset("HIFIVE","42","60","336","5","PSEUDO_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","192")236 curve_selected=True237 if x==7:238 curveset("GOLDILOCKS","56","58","448","7","GENERALISED_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","256")239 curve_selected=True240 if x==8:241 curveset("NIST384","48","56","384","7","NOT_SPECIAL","WEIERSTRASS","NOT","NOT","NOT","NOT","192")242 curve_selected=True243 if x==9:244 curveset("C41417","52","60","414","7","PSEUDO_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","256")245 curve_selected=True246 if x==10:247 curveset("NIST521","66","60","521","7","PSEUDO_MERSENNE","WEIERSTRASS","NOT","NOT","NOT","NOT","256")248 curve_selected=True249 if x==11:250 curveset("NUMS256W","32","56","256","3","PSEUDO_MERSENNE","WEIERSTRASS","NOT","NOT","NOT","NOT","128")251 curve_selected=True252 if x==12:253 curveset("NUMS256E","32","56","256","3","PSEUDO_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","128")254 curve_selected=True255 if x==13:256 curveset("NUMS384W","48","58","384","3","PSEUDO_MERSENNE","WEIERSTRASS","NOT","NOT","NOT","NOT","192")257 curve_selected=True258 if x==14:259 curveset("NUMS384E","48","56","384","3","PSEUDO_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","192")260 curve_selected=True261 if x==15:262 curveset("NUMS512W","64","60","512","7","PSEUDO_MERSENNE","WEIERSTRASS","NOT","NOT","NOT","NOT","256")263 curve_selected=True264 if x==16:265 curveset("NUMS512E","64","60","512","7","PSEUDO_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","256")266 curve_selected=True267 if x==17:268 curveset("SECP256K1","32","56","256","7","NOT_SPECIAL","WEIERSTRASS","NOT","NOT","NOT","NOT","128")269 curve_selected=True270 if x==18:271 curveset("BN254","32","56","254","3","NOT_SPECIAL","WEIERSTRASS","BN","D_TYPE","NEGATIVEX","66","128")272 pfcurve_selected=True273 if x==19:274 curveset("BN254CX","32","56","254","3","NOT_SPECIAL","WEIERSTRASS","BN","D_TYPE","NEGATIVEX","66","128")275 pfcurve_selected=True276 if x==20:277 curveset("BLS383","48","58","383","3","NOT_SPECIAL","WEIERSTRASS","BLS","M_TYPE","POSITIVEX","65","128")278 pfcurve_selected=True279 if x==21:280 curveset("BLS381","48","58","381","3","NOT_SPECIAL","WEIERSTRASS","BLS","M_TYPE","NEGATIVEX","65","128")281 pfcurve_selected=True282 if x==22:283 curveset("FP256BN","32","56","256","3","NOT_SPECIAL","WEIERSTRASS","BN","M_TYPE","NEGATIVEX","66","128")284 pfcurve_selected=True285 if x==23:286 curveset("FP512BN","64","60","512","3","NOT_SPECIAL","WEIERSTRASS","BN","M_TYPE","POSITIVEX","130","128")287 pfcurve_selected=True288# https://eprint.iacr.org/2017/334.pdf289 if x==24:290 curveset("BLS461","58","60","461","3","NOT_SPECIAL","WEIERSTRASS","BLS","M_TYPE","NEGATIVEX","78","128")291 pfcurve_selected=True292 if x==25:293 curveset("BLS24","60","56","479","3","NOT_SPECIAL","WEIERSTRASS","BLS","M_TYPE","POSITIVEX","49","192")294 pfcurve_selected=True295 if x==26:296 curveset("BLS48","70","58","556","3","NOT_SPECIAL","WEIERSTRASS","BLS","M_TYPE","POSITIVEX","42","256")297 pfcurve_selected=True298# rsaset(rsaname,big_length_bytes,bits_in_base,multiplier)299# The RSA name reflects the modulus size, which is a 2^m multiplier300# of the underlying big length301# There are choices here, different ways of getting the same result, but some faster than others302 if x==27:303 #256 is slower but may allow reuse of 256-bit BIGs used for elliptic curve304 #512 is faster.. but best is 1024305 rsaset("RSA2048","128","58","2")306 #rsaset("RSA2048","64","60","4")307 #rsaset("RSA2048","32","56","8")308 rsa_selected=True309 if x==28:310 rsaset("RSA3072","48","56","8")311 rsa_selected=True312 if x==29:313 #rsaset("RSA4096","32","56","16")314 rsaset("RSA4096","64","60","8")...

Full Screen

Full Screen

config32.py

Source:config32.py Github

copy

Full Screen

1import os2import sys3deltext=""4slashtext=""5copytext=""6if sys.platform.startswith("darwin") :7 copytext="cp "8 deltext="rm "9 slashtext="/"10if sys.platform.startswith("linux") :11 copytext="cp "12 deltext="rm "13 slashtext="/"14if sys.platform.startswith("win") :15 copytext="copy "16 deltext="del "17 slashtext="\\"18chosen=[]19cptr=020def replace(namefile,oldtext,newtext):21 f = open(namefile,'r')22 filedata = f.read()23 f.close()24 newdata = filedata.replace(oldtext,newtext)25 f = open(namefile,'w')26 f.write(newdata)27 f.close()28def rsaset(tb,nb,base,ml) :29 global deltext,slashtext,copytext30 global cptr,chosen31 chosen.append(tb)32 cptr=cptr+133 fpath="amcl"+slashtext+tb+slashtext34 os.system("mkdir amcl"+slashtext+tb)35 os.system(copytext+"ARCH32.go "+fpath+"ARCH.go")36 os.system(copytext+"BIG32.go "+fpath+"BIG.go")37 os.system(copytext+"DBIG.go "+fpath+"DBIG.go")38 os.system(copytext+"FF32.go "+fpath+"FF.go")39 os.system(copytext+"RSA.go "+fpath+"RSA.go")40 os.system(copytext+"CONFIG_BIG.go "+fpath+"CONFIG_BIG.go")41 os.system(copytext+"CONFIG_FF.go "+fpath+"CONFIG_FF.go")42 replace(fpath+"ARCH.go","XXX",tb)43 replace(fpath+"CONFIG_BIG.go","XXX",tb)44 replace(fpath+"CONFIG_FF.go","XXX",tb)45 replace(fpath+"BIG.go","XXX",tb)46 replace(fpath+"DBIG.go","XXX",tb)47 replace(fpath+"FF.go","XXX",tb)48 replace(fpath+"RSA.go","XXX",tb)49 replace(fpath+"CONFIG_BIG.go","@NB@",nb)50 replace(fpath+"CONFIG_BIG.go","@BASE@",base)51 replace(fpath+"CONFIG_FF.go","@ML@",ml);52def curveset(tc,nb,base,nbt,m8,mt,ct,pf,stw,sx,ab,cs) :53 global deltext,slashtext,copytext54 global cptr,chosen55 chosen.append(tc)56 cptr=cptr+157 fpath="amcl"+slashtext+tc+slashtext58 os.system("mkdir amcl"+slashtext+tc)59 os.system(copytext+"ARCH32.go "+fpath+"ARCH.go")60 os.system(copytext+"BIG32.go "+fpath+"BIG.go")61 os.system(copytext+"DBIG.go "+fpath+"DBIG.go")62 os.system(copytext+"FP.go "+fpath+"FP.go")63 os.system(copytext+"ECP.go "+fpath+"ECP.go")64 os.system(copytext+"ECDH.go "+fpath+"ECDH.go")65 os.system(copytext+"CONFIG_BIG.go "+fpath+"CONFIG_BIG.go")66 os.system(copytext+"CONFIG_FIELD.go "+fpath+"CONFIG_FIELD.go")67 os.system(copytext+"CONFIG_CURVE.go "+fpath+"CONFIG_CURVE.go")68 os.system(copytext+"ROM_"+tc+"_32.go "+fpath+"ROM.go")69 replace(fpath+"ARCH.go","XXX",tc)70 replace(fpath+"BIG.go","XXX",tc)71 replace(fpath+"DBIG.go","XXX",tc)72 replace(fpath+"FP.go","XXX",tc)73 replace(fpath+"ECP.go","XXX",tc)74 replace(fpath+"ECDH.go","XXX",tc)75 replace(fpath+"CONFIG_BIG.go","XXX",tc)76 replace(fpath+"CONFIG_FIELD.go","XXX",tc)77 replace(fpath+"CONFIG_CURVE.go","XXX",tc)78 replace(fpath+"CONFIG_BIG.go","@NB@",nb)79 replace(fpath+"CONFIG_BIG.go","@BASE@",base)80 replace(fpath+"CONFIG_FIELD.go","@NBT@",nbt)81 replace(fpath+"CONFIG_FIELD.go","@M8@",m8)82 replace(fpath+"CONFIG_FIELD.go","@MT@",mt)83 ib=int(base)84 inb=int(nb)85 inbt=int(nbt)86 sh=ib*(1+((8*inb-1)//ib))-inbt87 if sh > 14 :88 sh=1489 replace(fpath+"CONFIG_FIELD.go","@SH@",str(sh))90 replace(fpath+"CONFIG_CURVE.go","@CT@",ct)91 replace(fpath+"CONFIG_CURVE.go","@PF@",pf)92 replace(fpath+"CONFIG_CURVE.go","@ST@",stw)93 replace(fpath+"CONFIG_CURVE.go","@SX@",sx)94 replace(fpath+"CONFIG_CURVE.go","@AB@",ab)95 if cs == "128" :96 replace(fpath+"CONFIG_CURVE.go","@HT@","32")97 replace(fpath+"CONFIG_CURVE.go","@AK@","16")98 if cs == "192" :99 replace(fpath+"CONFIG_CURVE.go","@HT@","48")100 replace(fpath+"CONFIG_CURVE.go","@AK@","24")101 if cs == "256" :102 replace(fpath+"CONFIG_CURVE.go","@HT@","64")103 replace(fpath+"CONFIG_CURVE.go","@AK@","32")104 if pf != "NOT" :105 os.system(copytext+"FP2.go "+fpath+"FP2.go")106 os.system(copytext+"FP4.go "+fpath+"FP4.go")107 replace(fpath+"FP2.go","XXX",tc)108 replace(fpath+"FP4.go","XXX",tc)109 if cs == "128" :110 os.system(copytext+"ECP2.go "+fpath+"ECP2.go")111 os.system(copytext+"FP12.go "+fpath+"FP12.go")112 os.system(copytext+"PAIR.go "+fpath+"PAIR.go")113 os.system(copytext+"MPIN.go "+fpath+"MPIN.go")114 os.system(copytext+"BLS.go "+fpath+"BLS.go")115 replace(fpath+"FP12.go","XXX",tc)116 replace(fpath+"ECP2.go","XXX",tc)117 replace(fpath+"PAIR.go","XXX",tc)118 replace(fpath+"MPIN.go","XXX",tc)119 replace(fpath+"BLS.go","XXX",tc)120 if cs == "192" :121 os.system(copytext+"FP24.go "+fpath+"FP24.go")122 os.system(copytext+"FP8.go "+fpath+"FP8.go")123 os.system(copytext+"ECP4.go "+fpath+"ECP4.go")124 os.system(copytext+"PAIR192.go "+fpath+"PAIR192.go")125 os.system(copytext+"MPIN192.go "+fpath+"MPIN192.go")126 os.system(copytext+"BLS192.go "+fpath+"BLS192.go")127 replace(fpath+"FP24.go","XXX",tc)128 replace(fpath+"FP8.go","XXX",tc)129 replace(fpath+"ECP4.go","XXX",tc)130 replace(fpath+"PAIR192.go","XXX",tc)131 replace(fpath+"MPIN192.go","XXX",tc)132 replace(fpath+"BLS192.go","XXX",tc)133 if cs == "256" :134 os.system(copytext+"FP48.go "+fpath+"FP48.go")135 os.system(copytext+"FP16.go "+fpath+"FP16.go")136 os.system(copytext+"FP8.go "+fpath+"FP8.go")137 os.system(copytext+"ECP8.go "+fpath+"ECP8.go")138 os.system(copytext+"PAIR256.go "+fpath+"PAIR256.go")139 os.system(copytext+"MPIN256.go "+fpath+"MPIN256.go")140 os.system(copytext+"BLS256.go "+fpath+"BLS256.go")141 replace(fpath+"FP48.go","XXX",tc)142 replace(fpath+"FP16.go","XXX",tc)143 replace(fpath+"FP8.go","XXX",tc)144 replace(fpath+"ECP8.go","XXX",tc)145 replace(fpath+"PAIR256.go","XXX",tc)146 replace(fpath+"MPIN256.go","XXX",tc)147 replace(fpath+"BLS256.go","XXX",tc)148os.system("mkdir amcl")149os.system(copytext+ "HASH*.go amcl"+slashtext+".")150os.system(copytext+ "SHA3.go amcl"+slashtext+".")151os.system(copytext+ "RAND.go amcl"+slashtext+".")152os.system(copytext+ "AES.go amcl"+slashtext+".")153os.system(copytext+ "GCM.go amcl"+slashtext+".")154os.system(copytext+ "NHS.go amcl"+slashtext+".")155print("Elliptic Curves")156print("1. ED25519")157print("2. C25519")158print("3. NIST256")159print("4. BRAINPOOL")160print("5. ANSSI")161print("6. HIFIVE")162print("7. GOLDILOCKS")163print("8. NIST384")164print("9. C41417")165print("10. NIST521\n")166print("11. NUMS256W")167print("12. NUMS256E")168print("13. NUMS384W")169print("14. NUMS384E")170print("15. NUMS512W")171print("16. NUMS512E")172print("17. SECP256K1\n")173print("Pairing-Friendly Elliptic Curves")174print("18. BN254")175print("19. BN254CX")176print("20. BLS383")177print("21. BLS381")178print("22. FP256BN")179print("23. FP512BN")180print("24. BLS461\n")181print("25. BLS24")182print("26. BLS48\n")183print("RSA")184print("27. RSA2048")185print("28. RSA3072")186print("29. RSA4096")187selection=[]188ptr=0189max=30190curve_selected=False191pfcurve_selected=False192rsa_selected=False193while ptr<max:194 x=int(input("Choose a Scheme to support - 0 to finish: "))195 if x == 0:196 break197# print("Choice= ",x)198 already=False199 for i in range(0,ptr):200 if x==selection[i]:201 already=True202 break203 if already:204 continue205 selection.append(x)206 ptr=ptr+1207# curveset(curve,big_length_bytes,bits_in_base,modulus_bits,modulus_mod_8,modulus_type,curve_type,pairing_friendly,ate_bits,curve security)208# where "curve" is the common name for the elliptic curve209# big_length_bytes is the modulus size rounded up to a number of bytes210# bits_in_base gives the number base used for 32 bit architectures, as n where the base is 2^n211# modulus_bits is the actual bit length of the modulus.212# modulus_mod_8 is the remainder when the modulus is divided by 8213# modulus_type is NOT_SPECIAL, or PSEUDO_MERSENNE, or MONTGOMERY_Friendly, or GENERALISED_MERSENNE (supported for GOLDILOCKS only)214# curve_type is WEIERSTRASS, EDWARDS or MONTGOMERY215# pairing_friendly is BN, BLS or NOT (if not pairing friendly216# ate bits is number of bits in Ate parameter (from romgen program)217# curve security is AES equiavlent, rounded up.218 if x==1:219 curveset("ED25519","32","29","255","5","PSEUDO_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","128")220 curve_selected=True221 if x==2:222 curveset("C25519","32","29","255","5","PSEUDO_MERSENNE","MONTGOMERY","NOT","NOT","NOT","NOT","128")223 curve_selected=True224 if x==3:225 curveset("NIST256","32","28","256","7","NOT_SPECIAL","WEIERSTRASS","NOT","NOT","NOT","NOT","128")226 curve_selected=True227 if x==4:228 curveset("BRAINPOOL","32","28","256","7","NOT_SPECIAL","WEIERSTRASS","NOT","NOT","NOT","NOT","128")229 curve_selected=True230 if x==5:231 curveset("ANSSI","32","28","256","7","NOT_SPECIAL","WEIERSTRASS","NOT","NOT","NOT","NOT","128")232 curve_selected=True233 if x==6:234 curveset("HIFIVE","42","29","336","5","PSEUDO_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","192")235 curve_selected=True236 if x==7:237 curveset("GOLDILOCKS","56","29","448","7","GENERALISED_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","256")238 curve_selected=True239 if x==8:240 curveset("NIST384","48","29","384","7","NOT_SPECIAL","WEIERSTRASS","NOT","NOT","NOT","NOT","192")241 curve_selected=True242 if x==9:243 curveset("C41417","52","29","414","7","PSEUDO_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","256")244 curve_selected=True245 if x==10:246 curveset("NIST521","66","28","521","7","PSEUDO_MERSENNE","WEIERSTRASS","NOT","NOT","NOT","NOT","256")247 curve_selected=True248 if x==11:249 curveset("NUMS256W","32","28","256","3","PSEUDO_MERSENNE","WEIERSTRASS","NOT","NOT","NOT","NOT","128")250 curve_selected=True251 if x==12:252 curveset("NUMS256E","32","29","256","3","PSEUDO_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","128")253 curve_selected=True254 if x==13:255 curveset("NUMS384W","48","29","384","3","PSEUDO_MERSENNE","WEIERSTRASS","NOT","NOT","NOT","NOT","192")256 curve_selected=True257 if x==14:258 curveset("NUMS384E","48","29","384","3","PSEUDO_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","192")259 curve_selected=True260 if x==15:261 curveset("NUMS512W","64","29","512","7","PSEUDO_MERSENNE","WEIERSTRASS","NOT","NOT","NOT","NOT","256")262 curve_selected=True263 if x==16:264 curveset("NUMS512E","64","29","512","7","PSEUDO_MERSENNE","EDWARDS","NOT","NOT","NOT","NOT","256")265 curve_selected=True266 if x==17:267 curveset("SECP256K1","32","28","256","7","NOT_SPECIAL","WEIERSTRASS","NOT","NOT","NOT","NOT","128")268 curve_selected=True269 if x==18:270 curveset("BN254","32","28","254","3","NOT_SPECIAL","WEIERSTRASS","BN","D_TYPE","NEGATIVEX","66","128")271 pfcurve_selected=True272 if x==19:273 curveset("BN254CX","32","28","254","3","NOT_SPECIAL","WEIERSTRASS","BN","D_TYPE","NEGATIVEX","66","128")274 pfcurve_selected=True275 if x==20:276 curveset("BLS383","48","29","383","3","NOT_SPECIAL","WEIERSTRASS","BLS","M_TYPE","POSITIVEX","65","128")277 pfcurve_selected=True278 if x==21:279 curveset("BLS381","48","29","381","3","NOT_SPECIAL","WEIERSTRASS","BLS","M_TYPE","NEGATIVEX","65","128")280 pfcurve_selected=True281 if x==22:282 curveset("FP256BN","32","28","256","3","NOT_SPECIAL","WEIERSTRASS","BN","M_TYPE","NEGATIVEX","66","128")283 pfcurve_selected=True284 if x==23:285 curveset("FP512BN","64","29","512","3","NOT_SPECIAL","WEIERSTRASS","BN","M_TYPE","POSITIVEX","130","128")286 pfcurve_selected=True287# https://eprint.iacr.org/2017/334.pdf288 if x==24:289 curveset("BLS461","58","28","461","3","NOT_SPECIAL","WEIERSTRASS","BLS","M_TYPE","NEGATIVEX","78","128")290 pfcurve_selected=True291 if x==25:292 curveset("BLS24","60","29","479","3","NOT_SPECIAL","WEIERSTRASS","BLS","M_TYPE","POSITIVEX","49","192")293 pfcurve_selected=True294 if x==26:295 curveset("BLS48","70","29","556","3","NOT_SPECIAL","WEIERSTRASS","BLS","M_TYPE","POSITIVEX","32","256")296 pfcurve_selected=True297# rsaset(rsaname,big_length_bytes,bits_in_base,multiplier)298# The RSA name reflects the modulus size, which is a 2^m multiplier299# of the underlying big length300# There are choices here, different ways of getting the same result, but some faster than others301 if x==27:302 #256 is slower but may allow reuse of 256-bit BIGs used for elliptic curve303 #512 is faster.. but best is 1024304 rsaset("RSA2048","128","28","2")305 #rsaset("RSA2048","64","29","4")306 #rsaset("RSA2048","32","29","8")307 rsa_selected=True308 if x==28:309 rsaset("RSA3072","48","28","8")310 rsa_selected=True311 if x==29:312 #rsaset("RSA4096","32","29","16")313 rsaset("RSA4096","64","29","8")...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful