packages feed

raaz-0.3.11: api/auth/Implementation.hsig

{-# LANGUAGE ConstraintKinds             #-}
{-# LANGUAGE DataKinds                   #-}
{-# LANGUAGE KindSignatures              #-}
{-# LANGUAGE MultiParamTypeClasses       #-}
{-# LANGUAGE FlexibleInstances           #-}
{-# LANGUAGE TypeFamilies                #-}

-- | This signature imposes additional constraints on the primitive to
-- make it possible to use it as a message authenticator. Here is the list.
--
-- 1. The `Prim` type captures the message authentication code and
--    hence should be instances of `Eq`, so that we can compare
--    messages by checking the digest, `Equality`, so that the
--    equality comparison can be made timing safe when part of a
--    compound data, and `Encodeable` so that we can serialise the
--    authentication code to a byte string.
--
-- 2. To start the process of computing the message authentication,
--    the `Internal` state of the implementation should be initialised
--    using the secret key.
--
-- 3. At the end of the message, the authentication code, which recall
--    is captured by the type `Prim` should be extractable from the
--    internal state.
--

signature Implementation where

import Raaz.Core

data Prim
data Internals


instance Equality Prim
instance Eq Prim
instance Encodable Prim

instance Memory Internals
instance Initialisable Internals (Key Prim)
instance Extractable Internals Prim