Safe Haskell | None |
---|---|
Language | Haskell98 |
Generic cryptographic block primtives and their implementations. This module exposes low-level generic code used in the raaz system. Most likely, one would not need to stoop so low and it might be better to use a more high level interface.
- class Describable (Implementation p) => Primitive p where
- type Implementation p :: *
- class Primitive prim => Symmetric prim where
- type Key prim
- class Asymmetric prim where
- type PublicKey prim
- type PrivateKey prim
- class Primitive p => Recommendation p where
- data BLOCKS p
- blocksOf :: Primitive p => Int -> p -> BLOCKS p
Primtives and their implementations.
class Describable (Implementation p) => Primitive p where Source #
The type class that captures an abstract block cryptographic
primitive. Bulk cryptographic primitives like hashes, ciphers etc
often acts on blocks of data. The size of the block is captured by
the member blockSize
.
As a library, raaz believes in providing multiple implementations
for a given primitive. The associated type Implementation
captures implementations of the primitive.
There is a reference implementation where the emphasis is on correctness rather than speed or security. They are used to verify the correctness of the other implementations for the same primitive. Apart from this, for production use, we have a recommended implementation.
type Implementation p :: * Source #
Associated type that captures an implementation of this primitive.
Primitive SHA1 Source # | |
Primitive SHA224 Source # | |
Primitive SHA256 Source # | |
Primitive SHA384 Source # | |
Primitive SHA512 Source # | |
Hash h => Primitive (HMAC h) Source # | |
Primitive (AES 128 CBC) Source # | The 128-bit aes cipher in cbc mode. |
Primitive (AES 192 CBC) Source # | The 192-bit aes cipher in cbc mode. |
Primitive (AES 256 CBC) Source # | The 256-bit aes cipher in cbc mode. |
class Primitive prim => Symmetric prim Source #
A symmetric primitive. An example would be primitives like Ciphers, HMACs etc.
class Asymmetric prim Source #
An asymmetric primitive.
class Primitive p => Recommendation p where Source #
Primitives that have a recommended implementations.
recommended :: p -> Implementation p Source #
The recommended implementation for the primitive.
(Hash h, Recommendation h) => Recommendation (HMAC h) Source # | |
Type safe message length in units of blocks of the primitive.
When dealing with buffer lengths for a primitive, it is often
better to use the type safe units BLOCKS
. Functions in the raaz
package that take lengths usually allow any type safe length as
long as they can be converted to bytes. This can avoid a lot of
tedious and error prone length calculations.