-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial integration with elliptic curves without hashing and serialisation * Restore hashing functionality * Abstract Jacobian coordinates * Attempt to integrate galois-field-0.4 and elliptic-curve-0.2 * Refactor all square roots and Y from X functions * Relocate field and curve parameters and refactor conjugation and scalar multiplication * Remove redundant tests and reorganise tests layout * Remove redundant benchmarks and reorganise benchmarks layout * Refactor Shallue-van de Woestijne encoding * Update benchmarks * Restore serialisation codebase * Update change log and remove dependencies * Update elliptic-curve version * Remove redundant hashToG1 commented code * Rename pairing module for refactoring * Add pairing class * Add Barreto-Naehrig class * Prepend Math to modules * Update Galois fields and elliptic curves * Rename Math modules to Data * Fix tests and benchmarks compatibility * Restructure tests and benchmarks layout * Replace data families with types * Fix hash function * Relocate BN254 curve * Restructure library layout * Fix failing test * Relocate Pairing class * Restore G2 to BN254T of elliptic-curve and GT to RootsOfUnity Fq12 of galois-field * Improve performance of final exponentiation * Remove redundant roots of unity * Add BLS12381 skeleton * Add tests and benchmarks for roots of unity * Add Ate and Hash skeleton for BLS12381 * Update Galois fields * Add BLS48581, BN254A, BN254B, BN462 curves * Add optimal Ate pairings for BN254A and BN254B curves * Add type families and instances * Restructure tests and benchmarks layout * Add preliminary implementation of general optimal ate pairing algorithm * Refactor optimal ate pairing of Barreto Naehrig curves * Relocate individual curves into families * Add Barreto Lynn Scott pairings * Add Barreto-Naehrig phantom type and remove BN254 unity module * Remove undecidable instances * Refactor BN254A, BN254B, and BN462 modules * Rename curve families * Relocate curve modules * Remove base modules * Fix tests compilation * Add tests for Barreto-Naehrig curves and fix loop temporarily * Fix BN254A parameters * Optimise by removing line function * Fix BN462 parameters * Fix benchmarks compilation * Fix BN254B parameters * Remove field tests and benchmarks * Fix BLS12381 parameters * Remove bytes and serialisation temporarily * Revert family refactoring * Refactor complex conjugation * Add BN254C and BN254D curves * Refactor frobenius endomorphism * Add IsList instances * Add roots of unity function * Remove field conversions * Improve final exponentiation for Barreto-Naehrig curves * Improve final exponentiation for Barreto-Lynn-Scott curves * Add comments and improve layout * Add supported curves * Remove frobenius function * Update poly version * Update dependencies * Implement final exp bls48 easy part * Add hard part of final exponentiation for BLS48-581 * Relocate parameters to top level * Remove semirings dependency * Add polymorphic Shallue-van de Woestijne encoding hashing function to Barreto-Naehrig curves * Add Shallue-van de Woestijne encoding hashing function to Barreto-Lynn-Scott curves TODO and hide BLS48-581 tests * Remove BLS48-581 temporarily * Refactor line function * Refactor final step * Update hash functions * Improve Haddock documentation * Add field and curve tests * Update Galois fields * Update elliptic curves * Update change log, README, and documentation * Remove unnecessary dependencies * Update pairing example
- Loading branch information
Showing
45 changed files
with
2,328 additions
and
1,409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ pairing.cabal | |
*.hi | ||
*.o | ||
.ghc.environment.* | ||
dist*/ | ||
dist*/ | ||
TAGS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module Bench.Hash where | ||
|
||
import Protolude | ||
|
||
import Criterion.Main | ||
import Data.Pairing | ||
import qualified Data.Pairing.BLS12381 as BLS12381 | ||
import qualified Data.Pairing.BN254 as BN254 | ||
import qualified Data.Pairing.BN254A as BN254A | ||
import qualified Data.Pairing.BN254B as BN254B | ||
import qualified Data.Pairing.BN254C as BN254C | ||
import qualified Data.Pairing.BN254D as BN254D | ||
import qualified Data.Pairing.BN462 as BN462 | ||
import Data.Pairing.Hash | ||
|
||
benchHash :: Benchmark | ||
benchHash = bgroup "Shallue-van de Woestijne encoding hashing" | ||
[ bench "BN254" $ | ||
nfIO (swEncBN test_hash :: IO (Maybe (G1 BN254.BN254))) | ||
, bench "BN254A" $ | ||
nfIO (swEncBN test_hash :: IO (Maybe (G1 BN254A.BN254A))) | ||
, bench "BN254B" $ | ||
nfIO (swEncBN test_hash :: IO (Maybe (G1 BN254B.BN254B))) | ||
, bench "BN254C" $ | ||
nfIO (swEncBN test_hash :: IO (Maybe (G1 BN254C.BN254C))) | ||
, bench "BN254D" $ | ||
nfIO (swEncBN test_hash :: IO (Maybe (G1 BN254D.BN254D))) | ||
, bench "BN462" $ | ||
nfIO (swEncBN test_hash :: IO (Maybe (G1 BN462.BN462))) | ||
, bench "BLS12381" $ | ||
nfIO (swEncBN test_hash :: IO (Maybe (G1 BLS12381.BLS12381))) | ||
] | ||
|
||
test_hash :: ByteString | ||
test_hash = "TyqIPUBYojDVOnDPacfMGrGOzpaQDWD3KZCpqzLhpE4A3kRUCQFUx040Ok139J8WDVV2C99Sfge3G20Q8MEgu23giWmqRxqOc8pH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
module Bench.Pairing where | ||
|
||
import Protolude | ||
|
||
import Criterion.Main | ||
import Data.Curve | ||
import Data.Pairing | ||
import qualified Data.Pairing.BLS12381 as BLS12381 | ||
import qualified Data.Pairing.BN254 as BN254 | ||
import qualified Data.Pairing.BN254A as BN254A | ||
import qualified Data.Pairing.BN254B as BN254B | ||
import qualified Data.Pairing.BN254C as BN254C | ||
import qualified Data.Pairing.BN254D as BN254D | ||
import qualified Data.Pairing.BN462 as BN462 | ||
|
||
benchPairing :: Benchmark | ||
benchPairing = bgroup "Optimal ate pairing" | ||
[ bench "BLS12381" $ | ||
nf (uncurry pairing) bls12381 | ||
, bench "BN254" $ | ||
nf (uncurry pairing) bn254 | ||
, bench "BN254A" $ | ||
nf (uncurry pairing) bn254a | ||
, bench "BN254B" $ | ||
nf (uncurry pairing) bn254b | ||
, bench "BN254C" $ | ||
nf (uncurry pairing) bn254c | ||
, bench "BN254D" $ | ||
nf (uncurry pairing) bn254d | ||
, bench "BN462" $ | ||
nf (uncurry pairing) bn462 | ||
] | ||
|
||
bls12381 :: (G1 BLS12381.BLS12381, G2 BLS12381.BLS12381) | ||
bls12381 = (gen, gen) | ||
|
||
bn254 :: (G1 BN254.BN254, G2 BN254.BN254) | ||
bn254 = (gen, gen) | ||
|
||
bn254a :: (G1 BN254A.BN254A, G2 BN254A.BN254A) | ||
bn254a = (gen, gen) | ||
|
||
bn254b :: (G1 BN254B.BN254B, G2 BN254B.BN254B) | ||
bn254b = (gen, gen) | ||
|
||
bn254c :: (G1 BN254C.BN254C, G2 BN254C.BN254C) | ||
bn254c = (gen, gen) | ||
|
||
bn254d :: (G1 BN254D.BN254D, G2 BN254D.BN254D) | ||
bn254d = (gen, gen) | ||
|
||
bn462 :: (G1 BN462.BN462, G2 BN462.BN462) | ||
bn462 = (gen, gen) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.