Copyright | (c) Bogdan Manga 2018 Chris Peikert 2018 |
---|---|
License | GPL-3 |
Maintainer | cpeikert@alum.mit.edu |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Key-homomorphic PRF from [BP14].
Synopsis
- data FBT
- type SFBT = (Sing :: FBT -> Type)
- type family SizeFBT (a :: FBT) :: Pos where ...
- type FBTC (t :: FBT) = SingI t
- singFBT :: FBTC t => SFBT t
- data PRFKey n a
- data PRFParams n gad a
- data PRFState t n gad rq
- genKey :: forall rq rnd n. (MonadRandom rnd, Random rq, Reflects n Int) => rnd (PRFKey n rq)
- genParams :: forall gad rq rnd n. (MonadRandom rnd, Random rq, Reflects n Int, Gadget gad rq) => rnd (PRFParams n gad rq)
- prf :: (Rescale rq rp, Decompose gad rq) => SFBT t -> PRFParams n gad rq -> PRFKey n rq -> BitString (SizeFBT t) -> Matrix rp
- prfState :: (Rescale rq rp, Decompose gad rq) => SFBT t -> PRFParams n gad rq -> PRFKey n rq -> BitString (SizeFBT t) -> (Matrix rp, PRFState t n gad rq)
- prfAmortized :: (Rescale rq rp, Decompose gad rq, MonadState (Maybe (PRFState t n gad rq)) m) => SFBT t -> PRFParams n gad rq -> PRFKey n rq -> BitString (SizeFBT t) -> m (Matrix rp)
- run :: State (Maybe (PRFState t n gad rq)) a -> a
- runT :: Monad m => StateT (Maybe (PRFState t n gad rq)) m a -> m a
- data Vector n a
- type BitString n = Vector n Bool
- replicate :: forall n a. PosC n => a -> Vector n a
- replicateS :: SPos n -> a -> Vector n a
- fromList :: forall n a. PosC n => [a] -> Maybe (Vector n a)
- fromListS :: SPos n -> [a] -> Maybe (Vector n a)
- split :: forall m n a. PosC m => Vector (m `AddPos` n) a -> (Vector m a, Vector n a)
- splitS :: SPos m -> Vector (m `AddPos` n) a -> (Vector m a, Vector n a)
Documentation
Instances
SingKind FBT Source # | |
SingI Leaf Source # | |
Defined in Crypto.Lol.Applications.KeyHomomorphicPRF | |
(SingI n1, SingI n2) => SingI (Intern n1 n2 :: FBT) Source # | |
Defined in Crypto.Lol.Applications.KeyHomomorphicPRF | |
SingI d => SingI (TyCon1 (Intern d) :: FBT ~> FBT) Source # | |
SingI (TyCon2 Intern) Source # | |
data Sing (a :: FBT) Source # | |
type Demote FBT Source # | |
Defined in Crypto.Lol.Applications.KeyHomomorphicPRF |
data PRFParams n gad a Source #
PRF public parameters for an n
-dimension secret key over a
,
using a gadget indicated by gad
.
data PRFState t n gad rq Source #
PRF state for tree topology t
with key length n
over a
,
using gadget indicated by gad
.
genKey :: forall rq rnd n. (MonadRandom rnd, Random rq, Reflects n Int) => rnd (PRFKey n rq) Source #
Generate an n
-dimensional secret key over rq
.
genParams :: forall gad rq rnd n. (MonadRandom rnd, Random rq, Reflects n Int, Gadget gad rq) => rnd (PRFParams n gad rq) Source #
Generate public parameters (( mathbf{A}_0 ) and (
mathbf{A}_1 )) for n
-dimensional secret keys over a ring rq
for gadget indicated by gad
.
:: (Rescale rq rp, Decompose gad rq, MonadState (Maybe (PRFState t n gad rq)) m) | |
=> SFBT t | singleton for the tree \( T \) |
-> PRFParams n gad rq | public parameters |
-> PRFKey n rq | secret key \( s \) |
-> BitString (SizeFBT t) | input \( x \) |
-> m (Matrix rp) | PRF output |
Amortized PRF computation for a given secret key and input. The
output is in a monadic context that keeps a PRFState
state for
efficient amortization across calls.
run :: State (Maybe (PRFState t n gad rq)) a -> a Source #
Run a PRF computation with some public parameters.
E.g.: run top params (prf key x)
runT :: Monad m => StateT (Maybe (PRFState t n gad rq)) m a -> m a Source #
More general (monad transformer) version of run
.
Canonical type-safe sized vector
Instances
PosC n => Enum (Vector n Bool) Source # | Enumerates according to the n-bit Gray code, starting with all |
Defined in Crypto.Lol.Applications.KeyHomomorphicPRF succ :: Vector n Bool -> Vector n Bool # pred :: Vector n Bool -> Vector n Bool # toEnum :: Int -> Vector n Bool # fromEnum :: Vector n Bool -> Int # enumFrom :: Vector n Bool -> [Vector n Bool] # enumFromThen :: Vector n Bool -> Vector n Bool -> [Vector n Bool] # enumFromTo :: Vector n Bool -> Vector n Bool -> [Vector n Bool] # enumFromThenTo :: Vector n Bool -> Vector n Bool -> Vector n Bool -> [Vector n Bool] # | |
Eq a => Eq (Vector n a) Source # | |
Show a => Show (Vector n a) Source # | |
PosC n => Enumerable (Vector n Bool) Source # | |
Defined in Crypto.Lol.Applications.KeyHomomorphicPRF |