cryptotools/examples/elliptic/ecc.py
2026-02-18 12:32:05 +01:00

34 lines
575 B
Python

#!/usr/bin/env python3
import matplotlib.pyplot as plt
from Cryptotools.Groups.elliptic import Point, Elliptic
a = 3
b = 8
n = 89 # Must be prime number
E = Elliptic(n, a, b)
E.quadraticResidues()
Ep = E.pointsE()
#print(E.getQuadraticResidues())
# For the graphic
MAX=n
fig, ax = plt.subplots()
ax.legend(fontsize=14)
ax.grid()
# We generate x for the graphic
x = list()
x = [i for i in range(0, MAX)]
# Drawing the point.
for p in Ep:
ax.plot(p.x, p.y, 'bo')
# Draw a line for the symmetry
plt.axline([0, 45], [45, 45], linestyle="--", color="red")
plt.show()