Skip to content

Commit

Permalink
0.5 Release (#14)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sdiehl authored Aug 15, 2019
1 parent 95d6339 commit ff42eb0
Show file tree
Hide file tree
Showing 33 changed files with 1,104 additions and 2,175 deletions.
10 changes: 8 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change log for pairing

## 0.5

* Use `elliptic-curve` for BN254 elliptic curve group operations.
* Refactor Shallue-van de Woestijne encoding for efficiency.
* Temporarily remove serialisation.

## 0.4.2

* Fix overlapping instances of `Ord`.
Expand All @@ -11,7 +17,7 @@

## 0.4

* Use `galois-field` for tower field underlying BN128 curve.
* Use `galois-field` for tower field underlying BN254 curve.

## 0.3.1

Expand All @@ -25,7 +31,7 @@

## 0.2

* Add Shallue van de Woestijne encoding for curve hashing.
* Add Shallue-van de Woestijne encoding for curve hashing.

## 0.1

Expand Down
248 changes: 0 additions & 248 deletions bench/BenchPairing.hs

This file was deleted.

13 changes: 0 additions & 13 deletions bench/Main.hs

This file was deleted.

17 changes: 17 additions & 0 deletions benchmarks/HashBenchmarks.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module HashBenchmarks where

import Protolude

import Criterion.Main
import Pairing.Hash

benchmarkHash :: Benchmark
benchmarkHash = bgroup "Hash"
[ bgroup "Hash to G1"
[ bench "swEncBN"
$ whnfIO (swEncBN test_hash)
]
]

test_hash :: ByteString
test_hash = "TyqIPUBYojDVOnDPacfMGrGOzpaQDWD3KZCpqzLhpE4A3kRUCQFUx040Ok139J8WDVV2C99Sfge3G20Q8MEgu23giWmqRxqOc8pH"
12 changes: 12 additions & 0 deletions benchmarks/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Main where

import Protolude

import Criterion.Main

import HashBenchmarks
import PairingBenchmarks

main :: IO ()
main = defaultMain
[benchmarkHash, benchmarkPairing]
34 changes: 34 additions & 0 deletions benchmarks/PairingBenchmarks.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module PairingBenchmarks where

import Protolude

import Control.Monad.Random
import Criterion.Main
import GaloisField
import Pairing.Curve
import Pairing.Pairing

benchmarkPairing :: Benchmark
benchmarkPairing = bgroup "Pairing"
[ bgroup "Frobenius in Fq12"
[ bench "naive"
$ whnf (frobeniusNaive 1) testFq12
, bench "fast"
$ whnf (fq12Frobenius 1) testFq12
]
, bgroup "Final exponentiation"
[ bench "naive"
$ whnf finalExponentiationNaive testFq12
, bench "fast"
$ whnf finalExponentiation testFq12
]
, bgroup "Pairing"
[ bench "without final exponentiation"
$ whnf (uncurry atePairing) (gG1, gG2)
, bench "with final exponentiation"
$ whnf (uncurry reducedPairing) (gG1, gG2)
]
]

testFq12 :: Fq12
testFq12 = evalRand rnd (mkStdGen 0)
Loading

0 comments on commit ff42eb0

Please sign in to comment.