Giter VIP home page Giter VIP logo

fishfugu / elliptic Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 33.84 MB

Elliptic Curve Toolbox: Tools for finite field arithmetic and elliptic curve analysis. Includes modules for large integer operations, visualisation, and finite field calculations. Hopefully useful for researchers and developers in cryptography.

Home Page: https://www.creativearts.com.au/maths/une/sci395

License: MIT License

Makefile 11.97% Go 88.03%
cryptography elliptic-curve-arithmetic elliptic-curve-cryptography elliptic-curves literature-review mathematical-programming mathematics maths

elliptic's Introduction

Elliptic Curve Toolbox

Tools for analysis / manipulation of elliptic curves. Provides utilities for experimentation, and educational exploration of elliptic curve theory.

All partly inspired by my work over here: Recent course output - SCI395, with UNE. I'll be updating this site and this repo in tandem, as I go, and as I get to different parts of the investigation / analysis.

Current Features

  • Big Integer Arithmetic: Perform arithmetic operations on arbitrarily large integers with precise results.

  • Finite Field Calculation: Prime number finite field operations. Calculating points on an elliptic curve (in the Weierstrass form) defined on a prime integer finite field. Visualise prime integer finite field points, on an elliptic curve.

Getting Started

Prerequisites

  • Go version 1.21 or higher

May need this:

xcode-select --install

Installation

Clone the repository:

git clone https://github.com/fishfugu/elliptic.git
cd elliptic

Build the project

make build-all

Run tests

make test

Take it all for a test drive

AKA see example output and kick the tyres:

make test-drive

Makefile

Usage: make <TARGETS>

BUILD
  build-all                       Build the project - all necessary components
  build-bigmath                   Build bigmath executable
  build-finitefield               Build finitefield executable
  build-ecviz                     Build Elliptic Curve Data Viz Tool

RUN
  run-bigmath                     Run bigmath binary after building it - ensuring latest build is executed - running tests first
  run-finitefield                 Run finitefield binary after building it - ensuring latest build is executed - running tests first
  run-ecviz                       Run Elliptic Curve Data Viz Tool (after doing a build)

TEST and CLEAN
  test                            Run unit tests for all packages under pkg
  clean                           Remove binaries and any temporary files
  testdrive                       Run through all (appropriate) make file commands - just to take it for a test drive (check I haven't done stupidity)

HELPER
  test-quiet                      Run unit tests for all packages under pkg - but quietly - quits at first error
  test-verbose                    Run unit tests for all packages under pkg - in verbose mode
  help                            Show this help

Text Visualisation Example

2D Plane Visualization with Cartesian Axes, Reflection Line, and Scale:
|                                                                                        43
|                                                   *                                   
|                                             *                                         
|         *                                                                             
|           * *                                             *                            39
|                                                                                       
|     *                                                                                 
| *                                                                                     
|                                                                                        35
|                                                       *                               
|                                                             *                         
|                       *                                                               
|   *           *                                                 *                      31
|                                                                           *           
|                                                                                       
|                                                                                       
|                                                                                        27
|                                           *                                           
|                     *     *       *                                                   
|                                                                             *         
|                                                                               *        23
| . . . . . . . . . . . . . . * . . . . . . . . . . . . . . . . . . . . . . . . . . . .  43/2
|                             *                                                         
|                                                                               *       
|                                                                             *          19
|                     *     *       *                                                   
|                                           *                                           
|                                                                                       
|                                                                                        15
|                                                                                       
|                                                                           *           
|   *           *                                                 *                     
|                       *                                                                11
|                                                             *                         
|                                                       *                               
|                                                                                       
| *                                                                                      7
|     *                                                                                 
|                                                                                       
|           * *                                             *                           
|         *                                                                              3
|                                             *                                         
|                                                   *                                   
+ - - - / - - - / - - - / - - - / - - - / - - - / - - - / - - - / - - - / - - - / - * -  0

TODO

  • Makefile tidy - organise / make headings for help
  • Core algos for elliptic curve operations
    • Arbitrarily large finite filed ops - use BigInt - but make simpler
    • Find Prime
      • Work out how many checks is "good enough"
    • Check that use of BigInt versus own reimplement is consistent / sane
    • Investigate what "multiplying points" and "multiplicative inverse of points" means (extend lit review work: SCI395 Course Material )
  • Functions for operations within finite fields
    • Calculate points on an EC in prime finite field
    • Make ECs into types to hand around (immutable)
    • Implement adding points and multplying points in field by real nums
  • Visualization tools for elliptic curves
    • Basic text vis output
    • Debug the text vis output - scale / reflection line is wrong
    • Improve tick marks / scale numbers under x-axis
    • Vis adding and multplying numbers (see implementation above)
    • Turn vis into a window with real drawings thingy
    • Annimate doubling / adding / rings of points - text and / or proper drawing
  • Additional command line tools for other utilities
    • Turn this interactive and make current code into testdrive option
  • Comprehensive unit tests for elliptic curve functionalities
    • Do "random" test of more complex finite field calcs - rondomly selected in loop,small numbers without bigint, double checked / compared to function output

Contributing

Welcome contributions from anyone. Fork repo / submit PR.

Open to questions and input on where to go next - as I'd like to make this whole thing useful to others too.

elliptic's People

Contributors

fishfugu avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.