@@ -55,6 +55,29 @@ func CurveIDToString(id CurveID) string {
5555 }
5656}
5757
58+ func CurveNameToCurveID (name string ) CurveID {
59+ switch name {
60+ case "FP256BN_AMCL" :
61+ return FP256BN_AMCL
62+ case "BN254" :
63+ return BN254
64+ case "FP256BN_AMCL_MIRACL" :
65+ return FP256BN_AMCL_MIRACL
66+ case "BLS12_381" :
67+ return BLS12_381
68+ case "BLS12_377_GURVY" :
69+ return BLS12_377_GURVY
70+ case "BLS12_381_GURVY" :
71+ return BLS12_381_GURVY
72+ case "BLS12_381_BBS" :
73+ return BLS12_381_BBS
74+ case "BLS12_381_BBS_GURVY" :
75+ return BLS12_381_BBS_GURVY
76+ default :
77+ panic (fmt .Sprintf ("unknown curve %s" , name ))
78+ }
79+ }
80+
5881var Curves []* Curve = []* Curve {
5982 {
6083 c : amcl .NewFp256bn (),
@@ -225,8 +248,10 @@ func (z *Zr) Neg() {
225248 z .zr .Neg ()
226249}
227250
228- var zerobytes = []byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
229- var onebytes = []byte {255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 }
251+ var (
252+ zerobytes = []byte {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
253+ onebytes = []byte {255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 }
254+ )
230255
231256func (z * Zr ) Int () (int64 , error ) {
232257 b := z .Bytes ()
0 commit comments