楕円曲線暗号: メッセージの署名と検証
– 実数上の楕円曲線
実数は有理数、無理数を含む数(π, sqrt(2), e +7√19 など)
### 有限体上の楕円曲線
F103 でのy^2 = x^3 + 7
y^2 = 64^2 % 103 = 79
x^3 + 7 = (17^3 + 7) % 103 = 79
有限体に負が存在しないと、y^2の項によって真ん中の線に対して対称になる
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)
$ python3 app.py
<__main__.Point object at 0x7f1a3ceef2b0>
### 有限体における点の加算
prime = 223 a = FieldElement(num=0, prime=prime) b = FieldElement(num=7, prime=prime) x1 = FieldElement(num=192, prime=prime) y1 = FieldElement(num=105, prime=prime) x2 = FieldElement(num=17, prime=prime) y2 = FieldElement(num=56, prime=prime) p1 = Point(x1, y1, a, b) p2 = Point(x2, y2, a, b) print(p1+p2)
prime = 223 a = FieldElement(num=0, prime=prime) b = FieldElement(num=7, prime=prime) p1 = Point(FieldElement(170, prime), FieldElement(142, prime), a, b) p2 = Point(FieldElement(60, prime), FieldElement(139, prime), a, b) print(p1+p2) p1 = Point(FieldElement(47, prime), FieldElement(71, prime), a, b) p2 = Point(FieldElement(17, prime), FieldElement(56, prime), a, b) print(p1+p2) p1 = Point(FieldElement(143, prime), FieldElement(98, prime), a, b) p2 = Point(FieldElement(76, prime), FieldElement(66, prime), a, b) print(p1+p2)
ほう、なるほどー