| Portability | portable |
|---|---|
| Stability | beta |
| Maintainer | Thomas.DuBuisson@gmail.com |
| Safe Haskell | None |
Crypto.Modes
Contents
Description
Authors: Thomas DuBuisson
Generic mode implementations useable by any correct BlockCipher instance Be aware there are no tests for CFB mode yet. See Crypto.
- getIV :: (BlockCipher k, CryptoRandomGen g) => g -> Either GenError (IV k, g)
- getIVIO :: BlockCipher k => IO (IV k)
- zeroIV :: BlockCipher k => IV k
- incIV :: BlockCipher k => IV k -> IV k
- ecb :: BlockCipher k => k -> ByteString -> ByteString
- unEcb :: BlockCipher k => k -> ByteString -> ByteString
- cbc :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
- unCbc :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
- cfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
- unCfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
- ofb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
- unOfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
- ctr :: BlockCipher k => (IV k -> IV k) -> k -> IV k -> ByteString -> (ByteString, IV k)
- unCtr :: BlockCipher k => (IV k -> IV k) -> k -> IV k -> ByteString -> (ByteString, IV k)
- ctr' :: BlockCipher k => (IV k -> IV k) -> k -> IV k -> ByteString -> (ByteString, IV k)
- unCtr' :: BlockCipher k => (IV k -> IV k) -> k -> IV k -> ByteString -> (ByteString, IV k)
Initialization Vector Type, Modifiers (for all ciphers, all modes that use IVs)
getIV :: (BlockCipher k, CryptoRandomGen g) => g -> Either GenError (IV k, g)Source
Obtain an IV using the provided CryptoRandomGenerator.
zeroIV :: BlockCipher k => IV kSource
Obtain an IV made only of zeroes
incIV :: BlockCipher k => IV k -> IV kSource
Increase an IV by one. This is way faster than decoding, increasing, encoding
Blockcipher modes for lazy bytestrings. Versions for strict bytestrings are in Classes.
ecb :: BlockCipher k => k -> ByteString -> ByteStringSource
Cook book mode - not really a mode at all. If you don't know what you're doing, don't use this mode^H^H^H^H library.
unEcb :: BlockCipher k => k -> ByteString -> ByteStringSource
ECB decrypt, complementary to ecb.
cbc :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source
Cipher block chaining encryption for lazy bytestrings
unCbc :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source
Cipher block chaining decryption for lazy bytestrings
cfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source
Ciphertext feed-back encryption mode for lazy bytestrings (with s == blockSize)
unCfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source
Ciphertext feed-back decryption mode for lazy bytestrings (with s == blockSize)
ofb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source
Output feedback mode for lazy bytestrings
unOfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source
Output feedback mode for lazy bytestrings
ctr :: BlockCipher k => (IV k -> IV k) -> k -> IV k -> ByteString -> (ByteString, IV k)Source
Counter mode for lazy bytestrings
unCtr :: BlockCipher k => (IV k -> IV k) -> k -> IV k -> ByteString -> (ByteString, IV k)Source
Counter mode for lazy bytestrings
ctr' :: BlockCipher k => (IV k -> IV k) -> k -> IV k -> ByteString -> (ByteString, IV k)Source
Counter mode for strict bytestrings
unCtr' :: BlockCipher k => (IV k -> IV k) -> k -> IV k -> ByteString -> (ByteString, IV k)Source
Counter mode for strict bytestrings