For a finite field elliptic curve we can search for the first points for a curve of \(y^2 = x^3 + ax +b\) and for a defined prime number (\(p\)). This is defined as \(y^2 = x^3 + ax +b \pmod{p}\).
First 100 Elliptic Curve Points |
Sample run
A sample run is:
y^2 = x^3 + 5x+7 (mod 107) [(1, 86), (1, 21), (2, 102), (2, 5), (3, 100), (3, 7), (6, 57), (6, 50), (7, 99), (7, 8), (12, 61), (12, 46), (14, 57), (14, 50), (15, 56), (15, 51), (16, 44), (16, 63), (17, 61), (17, 46), (18, 30), (18, 77), (21, 99), (21, 8), (24, 83), (24, 24), (27, 64), (27, 43), (28, 48), (28, 59), (30, 34), (30, 73), (31, 10), (31, 97), (32, 34), (32, 73), (34, 76), (34, 31), (39, 52), (39, 55), (41, 92), (41, 15), (42, 49), (42, 58), (43, 11), (43, 96), (44, 102), (44, 5), (45, 34), (45, 73), (47, 75), (47, 32), (51, 33), (51, 74), (54, 39), (54, 68), (56, 40), (56, 67), (58, 53), (58, 54), (59, 53), (59, 54), (61, 102), (61, 5), (62, 79), (62, 28), (64, 0), (66, 89), (66, 18), (68, 29), (68, 78), (70, 23), (70, 84), (71, 12), (71, 95), (73, 4), (73, 103), (75, 79), (75, 28), (77, 79), (77, 28), (78, 61), (78, 46), (79, 99), (79, 8), (84, 64), (84, 43), (85, 85), (85, 22), (86, 48), (86, 59), (87, 57), (87, 50), (91, 105), (91, 2), (94, 62), (94, 45), (96, 36), (96, 71), (97, 53), (97, 54), (98, 14), (98, 93), (100, 48), (100, 59)]
For example with (1, 86) and for \(y^2 = x^3 + 5x + 7 \pmod {107}\), we have \({86}^2 = {1}^3 + 5 \times 1 + 7 \pmod{107}\). If we try with Python:
>>> 86**2 % 107 13 >>> (1+5+7) % 107 13
Coding
The outline code is:
import sys import libnum from libnum import ecc # y^2 = x^3 + ax + b (mod p) a=1 b=7 p=97 if (len(sys.argv)>1): a=int(sys.argv[1]) if (len(sys.argv)>2): b=int(sys.argv[2]) if (len(sys.argv)>3): p=int(sys.argv[3]) c = ecc.Curve(a,b,p) print ("y^2 = x^3 + %dx+%d (mod %d)\n" % (a,b,p)) if (p<100): print c.find_points_in_range(1,p-1) else: print c.find_points_in_range(1,100) print print "Ten random points: ",c.find_points_rand(10)