bulletproofs 0.1.0 → 0.2.0
raw patch · 13 files changed
+104/−44 lines, 13 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Bulletproofs.Curve: curveName :: CurveName
- Bulletproofs.Curve: generateH :: Point -> [Char] -> Point
- Bulletproofs.Curve: p :: Integer
- Bulletproofs.Curve: sha256 :: ByteString -> ByteString
- Bulletproofs.Fq: asInteger :: Fq -> Integer
- Bulletproofs.Fq: fqAdd :: Fq -> Fq -> Fq
- Bulletproofs.Fq: fqDiv :: Fq -> Fq -> Fq
- Bulletproofs.Fq: fqMul :: Fq -> Fq -> Fq
- Bulletproofs.Fq: fqMulV :: [Fq] -> [Fq] -> [Fq]
- Bulletproofs.Fq: fqNeg :: Fq -> Fq
- Bulletproofs.Fq: inv' :: (Integral a) => a -> a -> (a, a)
- Bulletproofs.Fq: norm :: Fq -> Fq
- Bulletproofs.RangeProof.Internal: encodeBit :: Integer -> Fq -> [Fq]
- Bulletproofs.RangeProof.Internal: fillWithZeros :: Integer -> [Fq] -> [Fq]
- Bulletproofs.RangeProof.Prover: computeLRPolys :: Integer -> [Fq] -> [Fq] -> [Fq] -> [Fq] -> Fq -> Fq -> LRPolys
- Bulletproofs.RangeProof.Prover: computeTPoly :: LRPolys -> TPoly
- Bulletproofs.Utils: isLogBase2 :: Integer -> Bool
Files
- Bulletproofs/Curve.hs +10/−2
- Bulletproofs/Fq.hs +14/−1
- Bulletproofs/InnerProductProof.hs +6/−8
- Bulletproofs/InnerProductProof/Internal.hs +5/−1
- Bulletproofs/InnerProductProof/Prover.hs +2/−2
- Bulletproofs/InnerProductProof/Verifier.hs +3/−3
- Bulletproofs/RangeProof.hs +6/−8
- Bulletproofs/RangeProof/Internal.hs +15/−1
- Bulletproofs/RangeProof/Prover.hs +6/−2
- Bulletproofs/RangeProof/Verifier.hs +7/−2
- Bulletproofs/Utils.hs +16/−1
- README.md +12/−11
- bulletproofs.cabal +2/−2
Bulletproofs/Curve.hs view
@@ -1,4 +1,13 @@-module Bulletproofs.Curve where+module Bulletproofs.Curve (+ q,+ g,+ h,+ gs,+ hs,+ curve,+ oracle,+ pointToBS,+) where import Protolude hiding (hash) @@ -11,7 +20,6 @@ import Crypto.Number.Serialize (os2ip) import Math.NumberTheory.Moduli.Sqrt (sqrtModP) --- TEST import Numeric import qualified Data.List as L
Bulletproofs/Fq.hs view
@@ -1,6 +1,19 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} -module Bulletproofs.Fq where+module Bulletproofs.Fq (+ Fq(..),+ new,+ inv,+ fqInv,+ fqZero,+ fqOne,+ fqSquare,+ fqCube,+ fqSubV,+ fqAddV,+ euclidean,+ random+) where import Protolude
Bulletproofs/InnerProductProof.hs view
@@ -1,12 +1,10 @@-module Bulletproofs.InnerProductProof-( generateProof-, verifyProof--, InnerProductProof(..)-, InnerProductBase(..)-, InnerProductWitness(..)+module Bulletproofs.InnerProductProof ( + generateProof,+ verifyProof,+ InnerProductProof(..),+ InnerProductBase(..),+ InnerProductWitness(..), ) where- import Bulletproofs.InnerProductProof.Internal import Bulletproofs.InnerProductProof.Prover
Bulletproofs/InnerProductProof/Internal.hs view
@@ -1,4 +1,8 @@-module Bulletproofs.InnerProductProof.Internal where+module Bulletproofs.InnerProductProof.Internal (+ InnerProductProof(..),+ InnerProductWitness(..),+ InnerProductBase(..),+) where import Protolude
Bulletproofs/InnerProductProof/Prover.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE NamedFieldPuns, MultiWayIf #-} -module Bulletproofs.InnerProductProof.Prover-( generateProof+module Bulletproofs.InnerProductProof.Prover ( + generateProof, ) where import Protolude
Bulletproofs/InnerProductProof/Verifier.hs view
@@ -1,8 +1,8 @@ {-# LANGUAGE RecordWildCards, NamedFieldPuns, MultiWayIf #-} -module Bulletproofs.InnerProductProof.Verifier- ( verifyProof- ) where+module Bulletproofs.InnerProductProof.Verifier ( + verifyProof,+) where import Protolude
Bulletproofs/RangeProof.hs view
@@ -1,13 +1,11 @@-module Bulletproofs.RangeProof-( RangeProof(..)-, RangeProofError(..)+module Bulletproofs.RangeProof ( + RangeProof(..)+ , RangeProofError(..) -, generateProof-, generateProofUnsafe-, verifyProof+ , generateProof+ , generateProofUnsafe+ , verifyProof ) where-- import Bulletproofs.RangeProof.Internal import Bulletproofs.RangeProof.Prover
Bulletproofs/RangeProof/Internal.hs view
@@ -1,4 +1,18 @@-module Bulletproofs.RangeProof.Internal where+module Bulletproofs.RangeProof.Internal (+ RangeProof(..),+ RangeProofError(..),+ LRPolys(..),+ TPoly(..),+ delta,+ checkRange,+ reversedEncodeBit,+ complementaryVector,+ chooseBlindingVectors,+ commitBitVectors,+ computeLRCommitment,+ obfuscateEncodedBits,+ obfuscateEncodedBitsSingle,+) where import Protolude
Bulletproofs/RangeProof/Prover.hs view
@@ -1,6 +1,9 @@ {-# LANGUAGE RecordWildCards, MultiWayIf #-} -module Bulletproofs.RangeProof.Prover where+module Bulletproofs.RangeProof.Prover (+ generateProof,+ generateProofUnsafe,+) where import Protolude @@ -14,7 +17,8 @@ import Bulletproofs.Fq as Fq import Bulletproofs.RangeProof.Internal -import Bulletproofs.InnerProductProof as IPP+import Bulletproofs.InnerProductProof as IPP hiding (generateProof)+import qualified Bulletproofs.InnerProductProof as IPP -- | Prove that a value lies in a specific range generateProof
Bulletproofs/RangeProof/Verifier.hs view
@@ -1,6 +1,10 @@ {-# LANGUAGE RecordWildCards, MultiWayIf, NamedFieldPuns, ViewPatterns #-} -module Bulletproofs.RangeProof.Verifier where+module Bulletproofs.RangeProof.Verifier (+ verifyProof,+ verifyTPoly,+ verifyLRCommitment,+) where import Protolude import Prelude (zipWith3)@@ -14,7 +18,8 @@ import Bulletproofs.Utils import Bulletproofs.Fq as Fq -import Bulletproofs.InnerProductProof as IPP+import Bulletproofs.InnerProductProof as IPP hiding (verifyProof)+import qualified Bulletproofs.InnerProductProof as IPP -- | Verify that a commitment was computed from a value in a given range verifyProof
Bulletproofs/Utils.hs view
@@ -1,4 +1,19 @@-module Bulletproofs.Utils where+module Bulletproofs.Utils (+ dotp,+ addP,+ subP,+ mulP,+ shamirU,+ shamirX,+ shamirX',+ shamirY,+ shamirZ,+ commit,+ hadamardp,+ powerVector,+ logBase2,+ logBase2M,+) where import Protolude
README.md view
@@ -2,7 +2,8 @@ <a href="http://www.adjoint.io"><img src="https://www.adjoint.io/assets/img/adjoint-logo@2x.png" width="250"/></a> </p> -[](https://circleci.com/gh/adjoint-io/bulletproofs)+[](https://circleci.com/gh/adjoint-io/bulletproofs)+[](http://hackage.haskell.org/package/bulletproofs) Bulletproofs are short zero-knowledge arguments of knowledge that do not require a trusted setup. Argument systems are proof systems with computational soundness.@@ -36,32 +37,32 @@ - **P -> V : A, S** - where A and S are blinded Pedersen commitments to **a<sub>L</sub>** and **a<sub>R</sub>**. - +  - +  - **V -> P : y, z** - Verifier sends challenges _y_ and _z_ to fix **A** and **S**. - **P -> V : T<sub>1</sub>, T<sub>2</sub>** - where T<sub>1</sub> and T<sub>2</sub> are commitments to the coefficients t<sub>1</sub>, of a polynomial t constructed from the existing values in the protocol. - &space;=&space;\textbf{a}_L&space;-&space;z&space;\cdot&space;\textbf{1}^n&space;+&space;\textbf{s}_L&space;\cdot&space;x&space;\in&space;\mathcal{Z}^n_p$)+ &space;=&space;\textbf{a}_L&space;-&space;z&space;\cdot&space;\textbf{1}^n&space;+&space;\textbf{s}_L&space;\cdot&space;x&space;\in&space;\mathbb{Z}^n_p$) - &space;=&space;\textbf{y}^n&space;\circ&space;(\textbf{a}_R&space;+&space;z&space;\cdot&space;\textbf{1}^n&space;+&space;\textbf{s}_R&space;\cdot&space;x&space;)&space;+&space;z^2&space;\cdot&space;\textbf{2}^n&space;\in&space;\mathcal{Z}^n_p&space;$)+ &space;=&space;\textbf{y}^n&space;\circ&space;(\textbf{a}_R&space;+&space;z&space;\cdot&space;\textbf{1}^n&space;+&space;\textbf{s}_R&space;\cdot&space;x&space;)&space;+&space;z^2&space;\cdot&space;\textbf{2}^n&space;\in&space;\mathbb{Z}^n_p&space;$) - +  - +  - **V -> P : x** - Verifier challenges Prover with value _x_. - **P -> V : tau, mu, t, l, r** - Prover sends several commitments that the verifier will then check. - +  - +  -See [Prover.hs](https://github.com/adjoint-io/bulletproofs/blob/master/src/RangeProof/Prover.hs "Prover.hs") for implementation details.+See [Prover.hs](https://github.com/adjoint-io/bulletproofs/blob/master/Bulletproofs/RangeProof/Prover.hs "Prover.hs") for implementation details. The interaction described is made non-interactive using the Fiat-Shamir Transform wherein all the random challenges made by V are replaced with a hash of the transcript up until that point.@@ -109,7 +110,7 @@ **References**: -1. Bunz B., Bootle J., Boneh J., Poelstra A., Wuille P., Maxwell G.+1. Bunz B., Bootle J., Boneh D., Poelstra A., Wuille P., Maxwell G. "Bulletproofs: Short Proofs for Confidential Transactions and More". Stanford, UCL, Blockstream, 2017 2. Groth J. "Linear Algebra with Sub-linear Zero-Knowledge Arguments". University College London, 2009
bulletproofs.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 3b89183974f949f3c27e1427d8945ec87f154533ac162d13451c5e50045d5d78+-- hash: b1527afdaf3310a51701ef0c756ab6e3cd6ed3606bc52e74b6a0a744bbbf5426 name: bulletproofs-version: 0.1.0+version: 0.2.0 description: Please see the README on GitHub at <https://github.com/githubuser/bulletproofs#readme> category: Cryptography homepage: https://github.com/adjoint-io/bulletproofs#readme