Crypto.Cipher.Types.Unsafe

crypto-cipher-types-0.0.9: Generic cryptography cipher types

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | Stable
Portability | Excellent
Safe Haskell | None
Language | Haskell98

Crypto.Cipher.Types.Unsafe

Description

mutable and unsafe interface for Block ciphers. export a BlockCipherIO class

Synopsis

- class BlockCipher cipher => BlockCipherIO cipher where
- type BufferLength = Word32
- type PtrDest = Ptr Word8
- type PtrSource = Ptr Word8
- type PtrIV = Ptr Word8
- onBlock :: BlockCipherIO cipher => cipher -> (ByteString -> ByteString) -> PtrDest -> PtrSource -> BufferLength -> IO ()

# Documentation

class BlockCipher cipher => BlockCipherIO cipher where #

Symmetric block cipher class, mutable API

Minimal complete definition

ecbEncryptMutable, ecbDecryptMutable

Methods

ecbEncryptMutable :: cipher -> PtrDest -> PtrSource -> BufferLength -> IO () #

Encrypt using the ECB mode.

input need to be a multiple of the blocksize

ecbDecryptMutable :: cipher -> PtrDest -> PtrSource -> BufferLength -> IO () #

Decrypt using the ECB mode.

input need to be a multiple of the blocksize

cbcEncryptMutable :: cipher -> PtrIV -> PtrDest -> PtrSource -> BufferLength -> IO () #

encrypt using the CBC mode.

input need to be a multiple of the blocksize

cbcDecryptMutable :: cipher -> PtrIV -> PtrDest -> PtrSource -> BufferLength -> IO () #

decrypt using the CBC mode.

input need to be a multiple of the blocksize

type BufferLength = Word32 #

Length of the pointed data

type PtrDest = Ptr Word8 #

pointer to the destination data

type PtrSource = Ptr Word8 #

pointer to the source data

type PtrIV = Ptr Word8 #

pointer to the IV data

onBlock :: BlockCipherIO cipher => cipher -> (ByteString -> ByteString) -> PtrDest -> PtrSource -> BufferLength -> IO () #

Helper to use a purer interface