Skip to content

Math of 384 bit numbers in pure cairo. Geared towards being used in ecc

License

Notifications You must be signed in to change notification settings

0xNonCents/multi-precision_cairo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi Precision Cairo

Math of 384 bit numbers in pure cairo

As a part of improving an eliptical curve library I have taken to implementing a reducible math library for 384 bit numbers. Division is not complete and will only work for numbers of roughly same size (see comments in code).

The library deals with positive whole integers since this will ultimatley be used in finite field math however the subtraction are included here in case someone wants to use this library for a different purpose. The edge case behavior ought to be tuned however for your desired use case.

How to use

git clone git@github.com:0xNonCents/multi-precision_cairo.git
cd multi-precision_cairo

To test
pytest

Directories and files
/lib/BigInt6.cairo - A struct representing a 384 bit unsigned integer
/lib/multi_precision.cairo - Math operations pertaining to this struct
/contracts/multi_precision.cairo - A test harness contract
/test/test_multi_precision.py - Tests for each multi_precision operation

About

Math of 384 bit numbers in pure cairo. Geared towards being used in ecc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published