bulletproofs-0.4.0

Safe HaskellNone
LanguageHaskell2010

Bulletproofs.Utils

Synopsis

Documentation

class AsInteger a where #

Methods

asInteger :: a -> Integer #

Instances
AsInteger Integer # 
Instance details

Defined in Bulletproofs.Utils

Methods

asInteger :: Integer -> Integer #

AsInteger Fq # 
Instance details

Defined in Bulletproofs.Utils

Methods

asInteger :: Fq -> Integer #

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

Methods

fSquare :: f -> f #

Instances
Field Fq # 
Instance details

Defined in Bulletproofs.Utils

Methods

fSquare :: Fq -> Fq #

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

Return a vector containing the first n powers of a

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

Hadamard product or entry wise multiplication of two vectors

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

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

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

addP :: Point -> Point -> Point #

Add two points of the same curve

subP :: Point -> Point -> Point #

Substract two points of the same curve

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

Multiply a scalar and a point in an elliptic curve

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

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

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

Raise every point to the corresponding exponent, sum up results

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

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

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

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

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

padToNearestPowerOfTwoOf #

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 #

Calculate ceiling of log base 2 of an integer.

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

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

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

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

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

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