-
Notifications
You must be signed in to change notification settings - Fork 7
/
Example.hs
36 lines (32 loc) · 974 Bytes
/
Example.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module Main where
import Data.Curve.Weierstrass (Point (A), mul')
import Data.Group (pow)
import Data.Pairing.BN254 (BN254, G1, G2, pairing)
import Protolude
p :: G1 BN254
p =
A
1368015179489954701390400359078579693043519447331113978918064868415326638035
9918110051302171585080402603319702774565515993150576347155970296011118125764
q :: G2 BN254
q =
A
[ 2725019753478801796453339367788033689375851816420509565303521482350756874229,
7273165102799931111715871471550377909735733521218303035754523677688038059653
]
[ 2512659008974376214222774206987427162027254181373325676825515531566330959255,
957874124722006818841961785324909313781880061366718538693995380805373202866
]
main :: IO ()
main = do
putText "P:"
print p
putText "Q:"
print q
putText "e(P, Q):"
print (pairing p q)
putText "e(P, Q) is bilinear:"
print $ pairing (mul' p a) (mul' q b) == pow (pairing p q) (a * b)
where
a = 2 :: Int
b = 3 :: Int