Skip to content

r5by/montgomery-ecc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Montgomery Elliptic Curve Cryptography (mont-ecc)

About this Repository

This repository offers a comprehensive implementation of elliptic curves, focusing on two primary forms:

  • Short Weierstrass Curve: Utilizes Jacobian coordinates to enhance computational efficiency.
  • Twisted Edwards Curves: Employs Extended coordinates, catering to a broader range of curve definitions.

The formulas used for both curve types adhere to the standards set by the Explicit Formulas Database (EFD).

Example Usages

The following examples illustrate basic operations such as point addition, doubling, and scaling on different types of curves:

# Example 1: Short Weierstrass Curve
p = 29  # Define the finite field F = Z/pZ
coeffs = [2, 20]  # Curve coefficients

# Initializing the domain with specific optimization settings
domain = Montgomery.factory(mod=p, mul_opt='real0').build()
curve = ShortWeierstrassCurve(domain, coeffs)

# Example 2: Twisted Edwards Curve
coeffs = [13, 21]
edward = TwistedEdwardsCurve(domain, coeffs)

# Perform curve operations such as point addition, doubling, and scalar multiplication

# <skipped> refer to unit tests for details

Notes:

For the Twisted Edwards curves, this implementation defaults to the "unified" addition and doubling formulas. This choice allows the library to support more generalized forms of Twisted Edwards curves, extending its applicability beyond standard protocol implementations. For standard curve operations, the dedicated formulas can also be used without issues as detailed in Reference 4.

References

  1. NIST SP 800-186
  2. RFC7748
  3. Twisted Edwards Curves
  4. Twisted Edwards Curves Revisited

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages