Find Subgroup with Point Addition

This section provides a tutorial example on how to find the subgroup of a given point on an elliptic curve using a loop of point additions with tinyec Python library.

Once you have elliptic curve created with tinyec Python library, you can find the subgroup of a given point on the curve with a loop of point additions:

>>> import tinyec.ec as ec

>>> s = ec.SubGroup(p=97,g=(0,0),n=1,h=1)

>>> c = ec.Curve(a=2,b=3,field=s,name='p97a2b3')

>>> p = ec.Point(curve=c,x=3,y=6)

>>> print(p)
(3, 6) on "p97a2b3" => y^2 = x^3 + 2x + 3 (mod 97)

>>> z = ec.Inf(c)   # represents the infinite point on the curve

>>> r = p
>>> for i in range(0,97):
...     print(r)
...     if (r == z):
...        break
...     r = r + p   # point addition operation
... ^Z

(3, 6) on "p97a2b3" => y^2 = x^3 + 2x + 3 (mod 97)
(80, 10) on "p97a2b3" => y^2 = x^3 + 2x + 3 (mod 97)
(80, 87) on "p97a2b3" => y^2 = x^3 + 2x + 3 (mod 97)
(3, 91) on "p97a2b3" => y^2 = x^3 + 2x + 3 (mod 97)
Inf on "p97a2b3" => y^2 = x^3 + 2x + 3 (mod 97)

Ok. We found the subgroup of base point (or generator) of p = (3,6). The group order is 5.

Note that we created an ec.Inf object to represent the infinite point on the curve, and used it as the condition to stop the loop.

Last update: 2019.

Table of Contents

 About This Book

 Geometric Introduction to Elliptic Curves

 Algebraic Introduction to Elliptic Curves

 Abelian Group and Elliptic Curves

 Discrete Logarithm Problem (DLP)

 Finite Fields

 Generators and Cyclic Subgroups

 Reduced Elliptic Curve Groups

 Elliptic Curve Subgroups

tinyec - Python Library for ECC

 What Is tinyec

 Download and Install tinyec

 Build New Curves with tinyec

 Perform Point Addition with tinyec

Find Subgroup with Point Addition

 Set Subgroup Order to Higher Value

 EC (Elliptic Curve) Key Pair

 ECDH (Elliptic Curve Diffie-Hellman) Key Exchange

 ECDSA (Elliptic Curve Digital Signature Algorithm)

 ECES (Elliptic Curve Encryption Scheme)

 Terminology

 References

 Full Version in PDF/EPUB