SimpleAES-0.3: Fast AES encryption/decryption for bytestringsSource codeContentsIndex
Codec.Crypto.SimpleAES
Description
A pure interface to AES
Synopsis
data Mode
= ECB
| CBC
data Direction
= Encrypt
| Decrypt
type Key = ByteString
type IV = ByteString
newIV :: IO IV
randomKey :: IO Key
crypt :: Mode -> Key -> IV -> Direction -> ByteString -> ByteString
encryptMsg :: Mode -> Key -> ByteString -> IO ByteString
encryptMsg' :: Mode -> Key -> IV -> ByteString -> ByteString
decryptMsg :: Mode -> Key -> ByteString -> ByteString
Documentation
data Mode Source
Constructors
ECB
CBC
data Direction Source
Constructors
Encrypt
Decrypt
type Key = ByteStringSource
type IV = ByteStringSource
newIV :: IO IVSource
randomKey :: IO KeySource
cryptSource
:: Mode
-> KeyThe AES key - 16, 24 or 32 bytes
-> IV
-> Direction
-> ByteStringBytestring to encrypt/decrypt
-> ByteString

Encryption/decryption for lazy bytestrings. The input string is zero-padded to a multiple of 16. It is your obligation to separate encode the length of the string.

Properties: x == y => crypt mode key iv dir x == crypt mode key iv dir y take (length x) (crypt mode key iv Decrypt (crypt mode key iv Encrypt x)) == x

encryptMsg :: Mode -> Key -> ByteString -> IO ByteStringSource
Encrypt a bytestring using a random seed (IV). Since the seed is random, this function is tainted by IO.
encryptMsg' :: Mode -> Key -> IV -> ByteString -> ByteStringSource
Encrypt a ByteString using a given seed (IV). The resulting ByteString contains both the seed and the original length of the input (before padding).
decryptMsg :: Mode -> Key -> ByteString -> ByteStringSource
Produced by Haddock version 2.6.0