Commit Graph

16 Commits

Author SHA1 Message Date
Mamy Ratsimbazafy d4e202ead5
Don't use array[^1], it can throw and cannot be locally turn off 2022-09-17 18:52:52 +02:00
Mamy Ratsimbazafy 7d29cb947a
Prepare for bindings generation 2022-07-16 13:34:27 +02:00
Mamy Ratsimbazafy ffacf61e8a
Don't dump all in "backend" (#184)
* backend -> math

* towers -> extension fields

* move ISA and compiler specific code out of math/

* fix export
2022-02-27 01:49:08 +01:00
Mamy Ratsimbazafy fe500a6a79
Productionize: move protocols top-level vs backend (#179)
* Productionize: move protocols top-level vs backend

* fix path

* import fix

* the last one

* benches as well
2022-02-21 01:04:53 +01:00
Mamy Ratsimbazafy dc73c71801
Pairings optimizations (#178)
* bench for cyclotomic square, exp and rename cyclotomic exp + multipairings for BLS12-377

* refactor/unify lines and cyclotomic functions

* Add Karabina's compressed squaring

* Use compressed squarings in final exponentiation

* Weighted addchain for bn254_snarks

* Add new towering options and cost functions

* Rearrange bench summaries

* fix BW6-761
2022-02-20 20:15:20 +01:00
Mamy Ratsimbazafy 53c4db7ead
Fast modular inversion (#172)
* split modular inversion in its own file

* Stash fast GCD inversion https://eprint.iacr.org/2020/972.pdf

* Stash Pornin's bingcd -> issue with inner modular reduction

* Implement Bernstein-Yang inversion

* Avoid Nim checks on signed integers (32-bit runtime issue)

* cleanup: remove old inversion impls

* cleanup: static moduli, move div2

* small comments (skip ci)

* comment cleanup (skip ci)

* fix total iterations on 32-bit

* Add batch conversion to affine coordinates using simultaneous inversion trick

* fix conditional setZero and batchAffine conversion

* cleanup unneeded branches following affine conversion unification

* Fix batchAffine with zero inputs and add fuzz failure to test suite
2022-02-10 14:05:07 +01:00
Mamy Ratsimbazafy c02e6bdf84
Tag vartime the bithacks that are not constant-time 2022-02-06 18:36:02 +01:00
Mamy Ratsimbazafy 50717d8de6
Test GT-subgroup for BW6-761 (#171) 2022-01-08 17:30:26 +01:00
Mamy Ratsimbazafy f6c02fe075
Optimized subgroup checks and cofactor clearing (#169)
* Move cofactor clearing to dedicated per-curve subgroups file

* Add BLS12-381 fast subgroup checks

* Implement fast cofactor clearing for BN254_snarks

* Add fast subgroup check to BN254Snarks

* add BLS12_377 optimized cofactor and subgroup functions

* Add BN254_Nogami

* Add GT-subgroup tests

* Use the new subgroup checks for Eth1 EVM precompiles
2022-01-03 14:12:58 +01:00
Mamy Ratsimbazafy c42e2a0251
Rename NotOnTwist/OnTwist => subgroup G1 and G2 2022-01-01 19:17:04 +01:00
Mamy Ratsimbazafy f5c0b6245d
Multipairing (#165)
* Productionize multipairings for BLS12-381

* typo

* arg order + benchmark

* Introduce mul_3way_sparse_sparse

* cleanup MultiMiller loop

* fix init sparse optimization in multimiller loop [skip ci]
2021-08-16 22:22:51 +02:00
Mamy André-Ratsimbazafy 976edb64bb
Move pairing_bw6_761 to staging area 2021-02-14 18:35:20 +01:00
Mamy André-Ratsimbazafy e9a1ef91fb
[Research] KZG polynomial commit and verify 2021-02-14 17:59:52 +01:00
Mamy André-Ratsimbazafy 2242650d38
move the multipairing file to research [skip ci] 2021-02-14 17:18:42 +01:00
Mamy André-Ratsimbazafy 799b6530f8
[research] Polynomial evaluation and verification [skip ci] 2021-02-14 17:14:33 +01:00
Mamy Ratsimbazafy 54887b1777
[Research] KZG polynomial commitment - part 1 FFT (#151)
* FFT compiles, now on to debugging ... [skip CI]

* Fix FFT and add bench [skip ci]

* rename + add KZG resources

* rename fft_fr

* Implement FFT on elliptic curves =)

* FFT G1 bench
2021-02-06 22:11:17 +01:00