pedersen-commitment-0.1.0: An implementation of Pedersen commitment schemes

Safe HaskellNone
LanguageHaskell2010

PrimeField

Synopsis

Documentation

data P Source #

A large, safe prime, p = 2q + 1, where q is a large prime

Instances

Eq P Source # 

Methods

(==) :: P -> P -> Bool #

(/=) :: P -> P -> Bool #

Ord P Source # 

Methods

compare :: P -> P -> Ordering #

(<) :: P -> P -> Bool #

(<=) :: P -> P -> Bool #

(>) :: P -> P -> Bool #

(>=) :: P -> P -> Bool #

max :: P -> P -> P #

min :: P -> P -> P #

Show P Source # 

Methods

showsPrec :: Int -> P -> ShowS #

show :: P -> String #

showList :: [P] -> ShowS #

data Q Source #

A large prime such that p = 2q + 1 and p is also prime

Instances

Eq Q Source # 

Methods

(==) :: Q -> Q -> Bool #

(/=) :: Q -> Q -> Bool #

Ord Q Source # 

Methods

compare :: Q -> Q -> Ordering #

(<) :: Q -> Q -> Bool #

(<=) :: Q -> Q -> Bool #

(>) :: Q -> Q -> Bool #

(>=) :: Q -> Q -> Bool #

max :: Q -> Q -> Q #

min :: Q -> Q -> Q #

Show Q Source # 

Methods

showsPrec :: Int -> Q -> ShowS #

show :: Q -> String #

showList :: [Q] -> ShowS #

data G Source #

A generator order Q for prime field order P

Instances

Eq G Source # 

Methods

(==) :: G -> G -> Bool #

(/=) :: G -> G -> Bool #

Ord G Source # 

Methods

compare :: G -> G -> Ordering #

(<) :: G -> G -> Bool #

(<=) :: G -> G -> Bool #

(>) :: G -> G -> Bool #

(>=) :: G -> G -> Bool #

max :: G -> G -> G #

min :: G -> G -> G #

Show G Source # 

Methods

showsPrec :: Int -> G -> ShowS #

show :: G -> String #

showList :: [G] -> ShowS #

data SPF Source #

A Safe Prime Field (Zp): Q = large prime P = 2Q + 1, also prime G = generator for Zp order q

spfP :: SPF -> P Source #

spfQ :: SPF -> Q Source #

spfG :: SPF -> G Source #

type SPFM = ReaderT SPF Source #

For computations using Safe Prime Field params

runSPFT :: SPF -> SPFM m a -> m a Source #

gexpSafeSPF :: SPF -> Integer -> Integer Source #

Compute g^e mod p

expSafeSPF :: SPF -> Integer -> Integer -> Integer Source #

Compute b^e mod p

randomInZq :: MonadRandom m => SPF -> m Integer Source #

Generate random number in Zq

randomInZp :: MonadRandom m => SPF -> m Integer Source #

Generate random number in Zp