EC Cryptography Tutorials - Herong's Tutorial Examples - v1.03, by Herong Yang
Download and Install tinyec
This section describes how to install tinyec, which can be done by running the 'pip install tinyec' command.
Installing tinyec is easy. All you need to do is to run this command:
herong> pip install tinyec Collecting tinyec Downloading https://files.pythonhosted.org/packages /c2/00/977e7339ae19b42ae10e 1219e5b13c0f54ef703e019be5d3e0b6bf5b90fe/tinyec-0.3.1.tar.gz Installing collected packages: tinyec Running setup.py install for tinyec ... done Successfully installed tinyec-0.3.1
Let's verify the installation with the following Python script:
herong> python >>> import tinyec.ec as ec >>> import tinyec.registry as reg >>> c = reg.get_curve("secp192r1") >>> print(c) "secp192r1" => y^2 = x^3 + 6277101735386680763835789423207666416083908700390324961276x + 2455155546008943817740293915197451784769108058161191238065 (mod 6277101735386680763835789423207666416083908700390324961279) >>> s = c.field >>> print(s) Subgroup => generator (602046282375688656758213480587526111916698976636884684818, 174050332293622031404857552280219410364023488927386650641), order: 6277101735386680763835789423176059013767194773182842284081, cofactor: 1 on Field => prime 6277101735386680763835789423207666416083908700390324961279
Ok. tinyec is installed correctly. It supports the named curve of "secp192r1" with a single predefined subgroup.
Table of Contents
Geometric Introduction to Elliptic Curves
Algebraic Introduction to Elliptic Curves
Abelian Group and Elliptic Curves
Discrete Logarithm Problem (DLP)
Generators and Cyclic Subgroups
►tinyec - Python Library for ECC
Perform Point Addition with tinyec
Find Subgroup with Point Addition
Set Subgroup Order to Higher Value
ECDH (Elliptic Curve Diffie-Hellman) Key Exchange
ECDSA (Elliptic Curve Digital Signature Algorithm)