Ecc Primer


Reading time: about 3 minutes
In [1]:
get_ipython().ast_node_interactivity = 'all'
import matplotlib.pyplot as plt
from collections import namedtuple
In [6]:
BYTES = 1

Curve = namedtuple("Curve", "mult add mod")

# Curve parameters
curve = Curve(0, 500, 7919)

def point_on_curve(x, y, curve):
    return (y * y) % curve.mod == ((x * x * x) + (curve.mult * x) + curve.add) % curve.mod

xs = []
ys = []

for x in range(curve.mod):
    for y in range(curve.mod):
        if point_on_curve(x, y, curve):
            xs.append(x)
            ys.append(y)

def point_add(x1, y1, x2, y2):
    s = 3 * (x1 * x1) // (2 * y1)
    
    x = (s*s) - (2 * x1)
    y = y1 + s * (x - x1)
    return x, y

def point_mult_int(point, k):
    x, y = point
    for _ in range(k):
        x, y = point_add(x, y, x, y)
    return x, y

G = (15, 13)
    

plt.scatter(xs, ys)
Out [6]:
Out:
<Figure size 432x288 with 1 Axes>

The following pages link here

Citation

If you find this work useful, please cite it as:
@article{yaltirakliwikieccprimer,
  title   = "Ecc Primer",
  author  = "Yaltirakli, Gokberk",
  journal = "gkbrk.com",
  year    = "2024",
  url     = "https://www.gkbrk.com/wiki/ecc-primer/"
}
Not using BibTeX? Click here for more citation styles.
IEEE Citation
Gokberk Yaltirakli, "Ecc Primer", November, 2024. [Online]. Available: https://www.gkbrk.com/wiki/ecc-primer/. [Accessed Nov. 12, 2024].
APA Style
Yaltirakli, G. (2024, November 12). Ecc Primer. https://www.gkbrk.com/wiki/ecc-primer/
Bluebook Style
Gokberk Yaltirakli, Ecc Primer, GKBRK.COM (Nov. 12, 2024), https://www.gkbrk.com/wiki/ecc-primer/

Comments

© 2024 Gokberk Yaltirakli