packages feed

raaz-0.3.11: api/digest/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 digest. Here is the list.
--
-- 1. The `Prim` type captures the message digest 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 `Encodable`
--    so that we can serialise the digest into a byte string.
--
-- 2. To start the process of computing the message digest the
--    `Internal` state of the implementation should use initialised by
--    @()@.
--
-- 3. At the end of the message, the digest, which recall is captured
--    by the type `Prim` should be extracted from the internal state.
--

signature Implementation where


import Raaz.Core

-- | The primitive.
data Prim

instance Eq Prim
instance Equality Prim
instance Encodable Prim

-- | The internal memory used by the primitive.
data Internals
instance Memory Internals


instance Initialisable Internals ()
instance Extractable Internals Prim