d = {192:105, 17:56, 200:119, 1:193, 42:99} prime = 223 for x, y in d.items(): a = (x**3 + 7)%prime b = (y**2)%prime if a == b: print('{}, {} is on the curve'.format(x, y)) else: print('sorry {}, {} is not on the curve'.format(x, y))
$ python3 test.py
192, 105 is on the curve
17, 56 is on the curve
sorry 200, 119 is not on the curve
1, 193 is on the curve
sorry 42, 99 is not on the curve
こうとも書ける
from ecc import FieldElement, Point a = FieldElement(num=0, prime=223) b = FieldElement(num=7, prime=223) x = FieldElement(num=192, prime=223) y = FieldElement(num=105, prime=223) p1 = Point(x, y, a, b) print(p1)