File tree 4 files changed +53
-7
lines changed
4 files changed +53
-7
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ module Bulletproofs.Curve (
12
12
) where
13
13
14
14
import Protolude hiding (hash )
15
+ import Data.Maybe (fromJust )
15
16
16
17
import Crypto.Hash
17
18
import qualified Crypto.PubKey.ECC.Generate as Crypto
@@ -20,7 +21,8 @@ import qualified Crypto.PubKey.ECC.Types as Crypto
20
21
21
22
import qualified Data.ByteArray as BA
22
23
import Crypto.Number.Serialize (os2ip )
23
- import Math.NumberTheory.Moduli.Sqrt (sqrtModP )
24
+ import Math.NumberTheory.Moduli.Sqrt (sqrtsModPrime )
25
+ import Math.NumberTheory.UniqueFactorisation (isPrime )
24
26
25
27
import Numeric
26
28
import qualified Data.List as L
@@ -98,11 +100,10 @@ _p = Crypto.ecc_p cp
98
100
generateH :: Crypto. Point -> [Char ] -> Crypto. Point
99
101
generateH basePoint extra =
100
102
case yM of
101
- Nothing -> generateH basePoint (toS $ ' 1' : extra)
102
- Just y -> if Crypto. isPointValid curve (Crypto. Point x y)
103
+ [] -> generateH basePoint (toS $ ' 1' : extra)
104
+ (y : _) -> if Crypto. isPointValid curve (Crypto. Point x y)
103
105
then Crypto. Point x y
104
106
else generateH basePoint (toS $ ' 1' : extra)
105
107
where
106
108
x = oracle (pointToBS basePoint <> toS extra) `mod` _p
107
- yM = sqrtModP (x ^ 3 + 7 ) _p
108
-
109
+ yM = sqrtsModPrime (fromInteger (x ^ 3 + 7 )) ((fromJust (isPrime _p)))
Original file line number Diff line number Diff line change 1
1
# Changelog for bulletproofs
2
2
3
+ ## 1.0.1
4
+
5
+ * Fix arithmoi dependency.
6
+ * Fix galois-field dependency.
7
+
3
8
## 1.0
4
9
5
10
* Use galois-field library as dependency
Original file line number Diff line number Diff line change 1
1
name : bulletproofs
2
- version : 1.0.0
2
+ version : 1.0.1
3
3
github : " adjoint-io/bulletproofs"
4
4
license : Apache
5
5
maintainer :
Adjoint Inc ([email protected] )
@@ -23,7 +23,7 @@ dependencies:
23
23
- text
24
24
- cryptonite
25
25
- memory
26
- - arithmoi
26
+ - arithmoi >= 0.8
27
27
- containers
28
28
- random-shuffle
29
29
- MonadRandom
Original file line number Diff line number Diff line change
1
+ # This file was autogenerated by Stack.
2
+ # You should not edit this file by hand.
3
+ # For more information, please see the documentation at:
4
+ # https://docs.haskellstack.org/en/stable/lock_files
5
+
6
+ packages:
7
+ - completed:
8
+ hackage: criterion-1.5.2.0@sha256:7ba73119322c7f481e93214853d208f1f9331e45d8b3b070da5a1d21c440826c,5324
9
+ pantry-tree:
10
+ size: 2213
11
+ sha256: 99737e889407fac08849d30554cc2fba49f2aa8e8683004563e092de18d8f008
12
+ original:
13
+ hackage: criterion-1.5.2.0
14
+ - completed:
15
+ hackage: galois-field-0.4.0@sha256:7f8aed0c11f6afc720685c2ede6bdbea3ce8dbd738dacd8fbf722168863d4dd1,3190
16
+ pantry-tree:
17
+ size: 1130
18
+ sha256: e68a2fb1731fc4cdf5f0ae4dd718f8bd2e128eb6285be3d602a209e5430812ba
19
+ original:
20
+ hackage: galois-field-0.4.0
21
+ - completed:
22
+ hackage: poly-0.3.1.0@sha256:3e015e84d304c4197a2cff4a78400ed619eb850922d566028edb6c7254f2095f,1875
23
+ pantry-tree:
24
+ size: 1466
25
+ sha256: ee6b1de208cdd7a621e3138fe3507f4a97d26ce3c47fe20021c1de75d3fddf29
26
+ original:
27
+ hackage: poly-0.3.1.0
28
+ - completed:
29
+ hackage: semirings-0.4.2@sha256:7803a3bd8add49c375da59d456b59e32ea02a88ac1a1d71132420e4c976333f3,3750
30
+ pantry-tree:
31
+ size: 555
32
+ sha256: dcf5c467c4005b567d409c3fe74aa233a6a9313a3693716eeee9ddafbd953f87
33
+ original:
34
+ hackage: semirings-0.4.2
35
+ snapshots:
36
+ - completed:
37
+ size: 499889
38
+ url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/13/26.yaml
39
+ sha256: ecb02ee16829df8d7219e7d7fe6c310819820bf335b0b9534bce84d3ea896684
40
+ original: lts-13.26
You can’t perform that action at this time.
0 commit comments