Skip to content

RicardoUMC/Elliptic-Curve-Arithmetic-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Elliptic Curve Arithmetic Library

This repository contains a custom implementation of elliptic curve arithmetic in C. It supports basic operations on elliptic curves such as verifying points, point addition, point negation, and scalar multiplication.

Table of Contents

Overview

The library provides functionalities to work with elliptic curves over finite fields defined by equations of the form:

The implementation uses GMP for arbitrary-precision arithmetic to ensure compatibility with large numbers.

Prerequisites

  • GCC or any C compiler
  • GMP library

Installing GMP

Ubuntu/Debian:

sudo apt update
sudo apt install libgmp-dev

macOS (using Homebrew):

brew install gmp

Windows:

Install GMP for Windows and ensure the headers and libraries are correctly linked during compilation.

Compilation

Use the following command to compile the example program:

gcc example.c EC.c -o example_program -lgmp

Usage

Example Program

An example usage of the library is provided in the example.c file. The program demonstrates:

  1. Initializing curve parameters.
  2. Checking if a point is on the curve.
  3. Point negation.
  4. Point addition (doubling).
  5. Scalar multiplication.

Run the compiled example:

./example_program

Expected output:

Point P(3, 6) is on the curve.
Negation of P: (3, 91)
Point Doubling: P + P = (80, 10)
Scalar Multiplication: 3P = (80, 87)

Features

  • Point Verification: Check if a given point lies on the elliptic curve.
  • Point Negation: Compute the negation of a point.
  • Point Addition: Add two points on the curve.
  • Scalar Multiplication: Multiply a point by a scalar.

Notes

  • Ensure all GMP dependencies are installed before compiling.
  • This library uses affine coordinates for simplicity.
  • Example values are predefined for demonstration purposes but can be replaced with custom inputs.

About

A C library for performing elliptic curve arithmetic over finite fields, including point verification, negation, addition, and scalar multiplication. It uses GMP for arbitrary-precision arithmetic and supports customizable curve parameters.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages