Commit Graph

306 Commits

Author SHA1 Message Date
Mamy André-Ratsimbazafy b810422486
Add benchmark for Ethereum 1 and Ethereum 2 curves 2020-03-15 20:54:14 +01:00
Mamy André-Ratsimbazafy dc0c1c181c
enable substraction benchmarks 2020-03-07 12:23:46 +01:00
Mamy André-Ratsimbazafy 472823b749
more comprehensive benchmark of Fp 2020-03-06 17:44:30 +01:00
Mamy André-Ratsimbazafy adc630f3af
Fix overflow on win32 2020-03-01 17:05:14 +01:00
Mamy André-Ratsimbazafy 4b7c6b552e
Fix inline assembly and inline __int128 in C++ mode 2020-03-01 16:23:41 +01:00
Mamy André-Ratsimbazafy c8e482f6d2
Properly handle 32 bits 2020-03-01 16:18:45 +01:00
Mamy André-Ratsimbazafy 3fdd457b52
Add MSVC compiler support for 128-bit div/mul (untested) 2020-03-01 16:02:14 +01:00
Mamy André-Ratsimbazafy dfb007e6bc
Add ARM64 fallback for Div128by64 2020-03-01 15:10:23 +01:00
Mamy André-Ratsimbazafy 3ce237234d
Support 32-bit platforms 2020-03-01 14:38:18 +01:00
Mamy André-Ratsimbazafy 1fdb1df80a
Add benchmark clock timers 2020-02-29 19:36:35 +01:00
Mamy André-Ratsimbazafy ca817fcb69
Use Assembly cmov on x86 2020-02-29 18:27:20 +01:00
Mamy André-Ratsimbazafy 309a15ce8b
inline func are OK for extended precision 2020-02-29 17:25:40 +01:00
Mamy André-Ratsimbazafy 0fab0c8a42
Improve initialization for montymul. (64-bit speed is 2.3x 32-bit) 2020-02-29 14:59:20 +01:00
Mamy André-Ratsimbazafy feacf2b2ea
Fix 64-bit limbs, passing all tests 2020-02-29 14:49:38 +01:00
Mamy André-Ratsimbazafy 88d4a58a10
First steps in using uint64 words 2020-02-29 02:10:55 +01:00
Mamy André-Ratsimbazafy 05bce529b4
1st experiment at accelerating montgomery multiplication (665 lines of specialized duplicated ASM code for some reason, monomorphization is probably better than that) 2020-02-28 22:46:20 +01:00
Mamy André-Ratsimbazafy 155aa21767
Add inverse on 𝔽p2 = 𝔽p[𝑖] 2020-02-27 01:20:51 +01:00
Mamy André-Ratsimbazafy feb6557402
Add placeholders for alternative Fp2 implementations 2020-02-26 20:04:06 +01:00
Mamy André-Ratsimbazafy 1f0ef23da7
Add Fp2_complex tests 2020-02-26 19:28:43 +01:00
Mamy André-Ratsimbazafy df886aa3ca
Significantly reduce compile-time and size of field tests vs GMP (4.4MB of C previously vs 160kB after commit). 2020-02-26 18:54:44 +01:00
Mamy André-Ratsimbazafy eecf19ff1d
more research on extension fields 2020-02-26 17:37:32 +01:00
Mamy André-Ratsimbazafy 6de97b5d1e
Random init was producing invalid montgomery form for field elements 2020-02-26 10:28:54 +01:00
Mamy André-Ratsimbazafy 945d36c2f2
More Fp2 sanity checks 2020-02-26 01:46:11 +01:00
Mamy André-Ratsimbazafy ff98558c4b
Fix carry bug in sum/diff 2020-02-26 01:31:05 +01:00
Mamy André-Ratsimbazafy c621355d8d
Add new tests to track issue in the new sum/diff 2020-02-26 01:23:18 +01:00
Mamy André-Ratsimbazafy 5fab0b6c49
Add secp256k1 and add sanity checks on Fp2 2020-02-26 00:55:30 +01:00
Mamy André-Ratsimbazafy e2096297cf
Expose the equality proc beyond the debugConstantine flag 2020-02-26 00:08:57 +01:00
Mamy André-Ratsimbazafy 9f7c8515a4
Prepare RNG with 2^512 bit of state for random testing on Fp2 2020-02-25 23:52:56 +01:00
Mamy André-Ratsimbazafy c956c82165
cleanup test imports 2020-02-25 20:55:23 +01:00
Mamy André-Ratsimbazafy 2df0f311ff
Cleanup TODOs + squaring in the Montgomery domain doesn't present the same symmetries as schoolbook multiplication so remove comment. Otherwise this may apply https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/large-integer-squaring-ia-paper.pdf 2020-02-25 20:12:38 +01:00
Mamy André-Ratsimbazafy 69d477a715
Fp2 multiplication 2020-02-25 16:35:55 +01:00
Mamy André-Ratsimbazafy 320ecbff1a
Change square signature and reorg finite fields to avoid/highlight proc that allocate a temporary 2020-02-25 15:18:39 +01:00
Mamy André-Ratsimbazafy abaafa816e
Fix warnings 2020-02-25 14:32:54 +01:00
Mamy André-Ratsimbazafy e6c7b3e52a
add Abelian Group concept 2020-02-25 14:10:59 +01:00
Mamy André-Ratsimbazafy 2aa33ea226
Fused initialization and arithmetic finite field primitive to have Fp2 less verbose and more efficient 2020-02-25 11:00:27 +01:00
Mamy André-Ratsimbazafy 2aec16d8d8
introduce unconditional add/sub and fused initialization+operation sum/diff 2020-02-25 03:11:32 +01:00
Mamy André-Ratsimbazafy ddce056bb4
make bench compile 2020-02-25 03:07:42 +01:00
Mamy André-Ratsimbazafy bb8dc579ea
conditional arithmetic prefixed with c: cadd, csub. Also use ccopy instead of cmov to avoid potential confusion like in https://github.com/cfrg/draft-irtf-cfrg-hash-to-curve/issues/210 2020-02-25 01:26:21 +01:00
Mamy André-Ratsimbazafy 5b53ad9cf3
Add references for finite fields and tower of finite fields arithmetic 2020-02-25 01:16:10 +01:00
Mamy André-Ratsimbazafy 78dee73648
Fp: setZero, setOne, double, in-place mul, Fp2: square 2020-02-24 20:39:36 +01:00
Mamy André-Ratsimbazafy 6b05c69652
Rename Fq -> Fp 2020-02-24 17:10:09 +01:00
Mamy Ratsimbazafy 3bd70991d4
reorg the codebase + add/update READMEs in folders with research (#12)
* reorg the codebase + add/update READMEs in folders with research

* fix readme

* update pairing implementation papers

* Seperate hash-to-curve in its own folder, distinguish between norms, research and presentations

* Better markdown line breaks

* Add in-depth analysis of towers of extension fields for BN curve

* Fix Colm Ó hÉigeartaigh name and add Hash-to-Curve reference
2020-02-24 10:50:19 +01:00
Mamy André-Ratsimbazafy d83101153a
Cosmetic changes: remove debug import strutils, BigInt.dec "returns" is now a doc comment, remove redundant setting the internal bitlength for modular multiplication 2020-02-23 21:49:51 +01:00
Mamy Ratsimbazafy 80f822c227
Set up CI with Azure Pipelines (#13)
* Set up CI with Azure Pipelines

[skip ci]

* Add task for testing without GMP

* Add C++ testing + no GMP on windows

* Add the Nim wrapper for GMP to Azure build

* Add Azure badge

* Fix nimble test tasks

* Workaround windows path in Azure

* Fix nim binaries path and mingw on 32-bit

* add stew test dependency

* Fix nim/nimble path

* disable GMP tests on windows
2020-02-23 18:27:26 +01:00
Mamy Ratsimbazafy acbb0f57f7
Travis CI (#14)
* add Travis config for x86_64 and ARM64

* Add Travis badge

* add stew test dependency

* comment out unused 64-bit word extended precision arithmetic for ARM CI
2020-02-23 17:56:43 +01:00
Mamy André-Ratsimbazafy 5f91751328
remove leftover debugEcho 2020-02-23 17:12:41 +01:00
Mamy André-Ratsimbazafy 05009f9407
Fix mux comment and link 2020-02-23 02:23:19 +01:00
Mamy André-Ratsimbazafy dc46e86490
Create a specialized montgomery modular square function 2020-02-23 01:43:42 +01:00
Mamy André-Ratsimbazafy c807707ee4
Add research on pairing curve implementations 2020-02-23 01:17:39 +01:00
Mamy André-Ratsimbazafy 68727e5c8d
Add modular inversion + test vs GMP 2020-02-22 19:50:24 +01:00