@@ -62,6 +62,20 @@ mod tests {
6262
6363 #[ test]
6464 fn test_scalar_mul ( ) {
65+ /*
66+ Here the coordinates in sage are in Weierstrass form, so we need to convert them to Edwards form.
67+ The formula is taken from https://github.com/zhenfeizhang/bandersnatch/blob/main/bandersnatch/script/bandersnatch.sage
68+ sage: p=52435875175126190479447740508185965837690552500527637822603658699938581184513
69+ sage: Fp = GF(p)
70+ sage: ban = EllipticCurve(Fp, [-3763200000,-78675968000000])
71+ sage: G = ban(0xa76451786f95a802c0982bbd0abd68e41b92adc86c8859b4f44679b21658710,0x44d150c8b4bd14f79720d021a839e7b7eb4ee43844b30243126a72ac2375490a)
72+ sage: G
73+ (4732093294267640299242820317528400560681136891967543338160850811774078125840 : 31127102290931869693084292284935581507759552409643462510093198106308390504714 : 1)
74+ sage: P = G*5
75+ sage: P
76+ (29008922875876791132439276322366220655270680966305110461148260308934935549949 : 5321989321016801167609012824343080578288974189043484058186624183847078047548 : 1)
77+ */
78+
6579 let g = BanderwagonCurve :: generator ( ) ;
6680 let result1 = g. operate_with_self ( 5u16 ) ;
6781
@@ -84,6 +98,17 @@ mod tests {
8498
8599 #[ test]
86100 fn test_create_valid_point_works ( ) {
101+ /*
102+ Here the coordinates in sage are in Weierstrass form, so we need to convert them to Twisted Edwards form.
103+ The formula is taken from https://github.com/zhenfeizhang/bandersnatch/blob/main/bandersnatch/script/bandersnatch.sage
104+ sage: p=52435875175126190479447740508185965837690552500527637822603658699938581184513
105+ sage: Fp = GF(p)
106+ sage: ban = EllipticCurve(Fp, [-3763200000,-78675968000000])
107+ sage: G = ban(0xa76451786f95a802c0982bbd0abd68e41b92adc86c8859b4f44679b21658710,0x44d150c8b4bd14f79720d021a839e7b7eb4ee43844b30243126a72ac2375490a)
108+ sage: G
109+ (4732093294267640299242820317528400560681136891967543338160850811774078125840 : 31127102290931869693084292284935581507759552409643462510093198106308390504714 : 1)
110+ */
111+
87112 let p = BanderwagonCurve :: generator ( ) ;
88113
89114 assert_eq ! ( p, p. clone( ) ) ;
@@ -113,6 +138,20 @@ mod tests {
113138
114139 #[ test]
115140 fn equality_works ( ) {
141+ /*
142+ Here the coordinates in sage are in Weierstrass form, so we need to convert them to Twisted Edwards form.
143+ The formula is taken from https://github.com/zhenfeizhang/bandersnatch/blob/main/bandersnatch/script/bandersnatch.sage
144+ sage: p=52435875175126190479447740508185965837690552500527637822603658699938581184513
145+ sage: Fp = GF(p)
146+ sage: ban = EllipticCurve(Fp, [-3763200000,-78675968000000])
147+ sage: G = ban(0xa76451786f95a802c0982bbd0abd68e41b92adc86c8859b4f44679b21658710,0x44d150c8b4bd14f79720d021a839e7b7eb4ee43844b30243126a72ac2375490a)
148+ sage: G
149+ (4732093294267640299242820317528400560681136891967543338160850811774078125840 : 31127102290931869693084292284935581507759552409643462510093198106308390504714 : 1)
150+ sage: R = G*2
151+ sage: R
152+ (31951609130618743256244397091892446950585800848077116798961915903626008441884 : 44003096583616910216940410849480500633572695092183489174446167302668306571218 : 1)
153+ */
154+
116155 let g = BanderwagonCurve :: generator ( ) ;
117156 let g2 = g. operate_with ( & g) ;
118157 assert_ne ! ( & g2, & g) ;
@@ -121,6 +160,20 @@ mod tests {
121160
122161 #[ test]
123162 fn operate_with_self_works_1 ( ) {
163+ /*
164+ Here the coordinates in sage are in Weierstrass form, so we need to convert them to Twisted Edwards form.
165+ The formula is taken from https://github.com/zhenfeizhang/bandersnatch/blob/main/bandersnatch/script/bandersnatch.sage
166+ sage: p=52435875175126190479447740508185965837690552500527637822603658699938581184513
167+ sage: Fp = GF(p)
168+ sage: ban = EllipticCurve(Fp, [-3763200000,-78675968000000])
169+ sage: G = ban(0xa76451786f95a802c0982bbd0abd68e41b92adc86c8859b4f44679b21658710,0x44d150c8b4bd14f79720d021a839e7b7eb4ee43844b30243126a72ac2375490a)
170+ sage: G
171+ (4732093294267640299242820317528400560681136891967543338160850811774078125840 : 31127102290931869693084292284935581507759552409643462510093198106308390504714 : 1)
172+ sage: Q = G*3
173+ sage: Q
174+ (31019807805656217859737735480197534678630587750605614610381590357187303463025 : 7443365003011992916088981749186597178295868666409019489786056142248668879353 : 1)
175+ */
176+
124177 let g = BanderwagonCurve :: generator ( ) ;
125178 assert_eq ! (
126179 g. operate_with( & g) . operate_with( & g) ,
0 commit comments