lol-apps-0.3.0.0: Lattice-based cryptographic applications using <https://hackage.haskell.org/package/lol lol>.

Copyright(c) Bogdan Manga 2018
Chris Peikert 2018
LicenseGPL-3
Maintainercpeikert@alum.mit.edu
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Crypto.Lol.Applications.KeyHomomorphicPRF

Description

Key-homomorphic PRF from [BP14].

Synopsis

Documentation

data FBT Source #

Constructors

Leaf 
Intern FBT FBT 
Instances
SingKind FBT Source # 
Instance details

Defined in Crypto.Lol.Applications.KeyHomomorphicPRF

Associated Types

type Demote FBT = (r :: Type) #

SingI Leaf Source # 
Instance details

Defined in Crypto.Lol.Applications.KeyHomomorphicPRF

Methods

sing :: Sing Leaf #

(SingI n1, SingI n2) => SingI (Intern n1 n2 :: FBT) Source # 
Instance details

Defined in Crypto.Lol.Applications.KeyHomomorphicPRF

Methods

sing :: Sing (Intern n1 n2) #

SingI d => SingI (TyCon1 (Intern d) :: FBT ~> FBT) Source # 
Instance details

Defined in Crypto.Lol.Applications.KeyHomomorphicPRF

Methods

sing :: Sing (TyCon1 (Intern d)) #

SingI (TyCon2 Intern) Source # 
Instance details

Defined in Crypto.Lol.Applications.KeyHomomorphicPRF

Methods

sing :: Sing (TyCon2 Intern) #

data Sing (a :: FBT) Source # 
Instance details

Defined in Crypto.Lol.Applications.KeyHomomorphicPRF

data Sing (a :: FBT) where
type Demote FBT Source # 
Instance details

Defined in Crypto.Lol.Applications.KeyHomomorphicPRF

type Demote FBT = FBT

type SFBT = (Sing :: FBT -> Type) Source #

type family SizeFBT (a :: FBT) :: Pos where ... Source #

Equations

SizeFBT Leaf = OSym0 
SizeFBT (Intern l r) = Apply (Apply AddPosSym0 (Apply SizeFBTSym0 l)) (Apply SizeFBTSym0 r) 

type FBTC (t :: FBT) = SingI t Source #

Kind-restricted type synonym for SingI

singFBT :: FBTC t => SFBT t Source #

Kind-restricted synonym for sing

data PRFKey n a Source #

A PRF secret key of dimension n over ring a.

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.

prf Source #

Arguments

:: (Rescale rq rp, Decompose gad rq) 
=> SFBT t

singleton for the tree \( T \)

-> PRFParams n gad rq

public parameters

-> PRFKey n rq

secret key \( s \)

-> BitString (SizeFBT t)

input \( x \)

-> Matrix rp 

Fresh PRF computation, with no precomputed PRFState.

prfState Source #

Arguments

:: (Rescale rq rp, Decompose gad rq) 
=> SFBT t

singleton for the tree \( T \)

-> PRFParams n gad rq

public parameters

-> PRFKey n rq

secret key \( s \)

-> BitString (SizeFBT t)

input \( x \)

-> (Matrix rp, PRFState t n gad rq) 

Fresh PRF computation that also outputs the resulting PRFState.

prfAmortized Source #

Arguments

:: (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.

data Vector n a Source #

Canonical type-safe sized vector

Instances
PosC n => Enum (Vector n Bool) Source #

Enumerates according to the n-bit Gray code, starting with all False

Instance details

Defined in Crypto.Lol.Applications.KeyHomomorphicPRF

Eq a => Eq (Vector n a) Source # 
Instance details

Defined in Crypto.Lol.Applications.KeyHomomorphicPRF

Methods

(==) :: Vector n a -> Vector n a -> Bool #

(/=) :: Vector n a -> Vector n a -> Bool #

Show a => Show (Vector n a) Source # 
Instance details

Defined in Crypto.Lol.Applications.KeyHomomorphicPRF

Methods

showsPrec :: Int -> Vector n a -> ShowS #

show :: Vector n a -> String #

showList :: [Vector n a] -> ShowS #

PosC n => Enumerable (Vector n Bool) Source # 
Instance details

Defined in Crypto.Lol.Applications.KeyHomomorphicPRF

Methods

values :: [Vector n Bool] #

type BitString n = Vector n Bool Source #

An n-dimensional Vector of Bools

replicate :: forall n a. PosC n => a -> Vector n a Source #

Create a Vector full of given value

replicateS :: SPos n -> a -> Vector n a Source #

Alternative form of replicate

fromList :: forall n a. PosC n => [a] -> Maybe (Vector n a) Source #

Convert a list to a Vector, return Nothing if lengths don't match

fromListS :: SPos n -> [a] -> Maybe (Vector n a) Source #

split :: forall m n a. PosC m => Vector (m `AddPos` n) a -> (Vector m a, Vector n a) Source #

Split a Vector into two

splitS :: SPos m -> Vector (m `AddPos` n) a -> (Vector m a, Vector n a) Source #

Alternative form of split