{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TypeFamilies #-} -- | Implementation of stream ciphers. Since encryption/decryption is -- done by typically xoring the keystream witht he data, the have two -- property. -- -- 1. Using the same key stream can compromise the safety so typically these -- primitives take, apart from the key a nounce that needs to be distinct. -- It is the key nounce pair that should not be reused. -- -- 2. They usually can rewind/advace/skip input and perform -- encryption/decryption. -- signature Implementation where import Raaz.Core -- | The primitive data Prim -- | The internal memory used by the implementation. data Internals instance Memory Internals instance Initialisable Internals (Key Prim) instance Initialisable Internals (Nounce Prim) instance Initialisable Internals (BlockCount Prim) -- To restore/advance -- to a particular -- block in the stream instance Extractable Internals (BlockCount Prim) -- To query the position