Skip to content

Commit a1d3bb1

Browse files
committed
more tests for PointJacobi
1 parent 61133a6 commit a1d3bb1

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

src/ecdsa/test_jacobi.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,29 @@ def test_add_same_scale_points(self, a_mul, b_mul, new_z):
312312

313313
self.assertEqual(c, j_g * (a_mul + b_mul))
314314

315+
def test_add_same_scale_points_static(self):
316+
j_g = generator_brainpoolp160r1
317+
p = curve_brainpoolp160r1.p()
318+
a = j_g * 11
319+
a.scale()
320+
z1 = 13
321+
x = PointJacobi(
322+
curve_brainpoolp160r1,
323+
a.x() * z1 ** 2 % p,
324+
a.y() * z1 ** 3 % p,
325+
z1,
326+
)
327+
y = PointJacobi(
328+
curve_brainpoolp160r1,
329+
a.x() * z1 ** 2 % p,
330+
a.y() * z1 ** 3 % p,
331+
z1,
332+
)
333+
334+
c = a + a
335+
336+
self.assertEqual(c, x + y)
337+
315338
@settings(max_examples=14)
316339
@given(
317340
st.integers(
@@ -363,6 +386,30 @@ def test_add_different_scale_points(self, a_mul, b_mul, new_z):
363386

364387
self.assertEqual(c, j_g * (a_mul + b_mul))
365388

389+
def test_add_different_scale_points_static(self):
390+
j_g = generator_brainpoolp160r1
391+
p = curve_brainpoolp160r1.p()
392+
a = j_g * 11
393+
a.scale()
394+
z1 = 13
395+
x = PointJacobi(
396+
curve_brainpoolp160r1,
397+
a.x() * z1 ** 2 % p,
398+
a.y() * z1 ** 3 % p,
399+
z1,
400+
)
401+
z2 = 29
402+
y = PointJacobi(
403+
curve_brainpoolp160r1,
404+
a.x() * z2 ** 2 % p,
405+
a.y() * z2 ** 3 % p,
406+
z2,
407+
)
408+
409+
c = a + a
410+
411+
self.assertEqual(c, x + y)
412+
366413
def test_add_point_3_times(self):
367414
j_g = PointJacobi.from_affine(generator_256)
368415

0 commit comments

Comments
 (0)