Safe Haskell | None |
---|---|

Language | Haskell2010 |

## Synopsis

- class AsInteger a where
- class (Num f, Fractional f) => Field f where
- fSquare :: f -> f

- powerVector :: (Eq f, Num f) => f -> Integer -> [f]
- hadamardp :: Num a => [a] -> [a] -> [a]
- dot :: Num a => [a] -> [a] -> a
- (^+^) :: Num a => [a] -> [a] -> [a]
- (^-^) :: Num a => [a] -> [a] -> [a]
- addP :: Point -> Point -> Point
- subP :: Point -> Point -> Point
- mulP :: AsInteger f => f -> Point -> Point
- addTwoMulP :: AsInteger f => f -> Point -> f -> Point -> Point
- sumExps :: AsInteger f => [f] -> [Point] -> Point
- commit :: AsInteger f => f -> f -> Point
- isLogBase2 :: Integer -> Bool
- logBase2 :: Integer -> Integer
- logBase2M :: Integer -> Maybe Integer
- slice :: Integer -> Integer -> [a] -> [a]
- padToNearestPowerOfTwo :: Num f => [f] -> [f]
- padToNearestPowerOfTwoOf :: Num f => Int -> [f] -> [f]
- log2Ceil :: Int -> Int
- randomN :: MonadRandom m => Integer -> m 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

# Documentation

class (Num f, Fractional f) => Field f where 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

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

isLogBase2 :: Integer -> Bool 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 #

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

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