bulletproofs-0.4.0

Safe HaskellNone
LanguageHaskell2010

Bulletproofs.Utils

Synopsis

Documentation

class AsInteger a where Source #

Methods

asInteger :: a -> Integer Source #

Instances
AsInteger Integer Source # 
Instance details

Defined in Bulletproofs.Utils

AsInteger Fq Source # 
Instance details

Defined in Bulletproofs.Utils

Methods

asInteger :: Fq -> Integer Source #

class (Num f, Fractional f) => Field f where Source #

Methods

fSquare :: f -> f Source #

Instances
Field Fq Source # 
Instance details

Defined in Bulletproofs.Utils

Methods

fSquare :: Fq -> Fq Source #

powerVector :: (Eq f, Num f) => f -> Integer -> [f] Source #

Return a vector containing the first n powers of a

hadamardp :: Num a => [a] -> [a] -> [a] Source #

Hadamard product or entry wise multiplication of two vectors

dot :: Num a => [a] -> [a] -> a Source #

(^+^) :: Num a => [a] -> [a] -> [a] Source #

(^-^) :: Num a => [a] -> [a] -> [a] Source #

addP :: Point -> Point -> Point Source #

Add two points of the same curve

subP :: Point -> Point -> Point Source #

Substract two points of the same curve

mulP :: AsInteger f => f -> Point -> Point Source #

Multiply a scalar and a point in an elliptic curve

addTwoMulP :: AsInteger f => f -> Point -> f -> Point -> Point Source #

Double exponentiation (Shamir's trick): g0^x0 + g1^x1

sumExps :: AsInteger f => [f] -> [Point] -> Point Source #

Raise every point to the corresponding exponent, sum up results

commit :: AsInteger f => f -> f -> Point Source #

Create a Pedersen commitment to a value given a value and a blinding factor

slice :: Integer -> Integer -> [a] -> [a] Source #

padToNearestPowerOfTwo :: Num f => [f] -> [f] Source #

Append minimal amount of zeroes until the list has a length which is a power of two.

padToNearestPowerOfTwoOf Source #

Arguments

:: Num f 
=> Int

n

-> [f]

list which should have length <= 2^n

-> [f]

list which will have length 2^n

Given n, append zeroes until the list has length 2^n.

log2Ceil :: Int -> Int Source #

Calculate ceiling of log base 2 of an integer.

chooseBlindingVectors :: (Num f, MonadRandom m) => Integer -> m ([f], [f]) Source #

shamirY :: Num f => Point -> Point -> f Source #

shamirZ :: (Show f, Num f) => Point -> Point -> f -> f Source #

shamirX :: (Show f, Num f) => Point -> Point -> Point -> Point -> f -> f -> f Source #

shamirX' :: Num f => Point -> Point -> Point -> f Source #

shamirU :: (Show f, Num f) => f -> f -> f -> f Source #