SimpleAES-0.4.1: Fast AES encryption/decryption for bytestrings

Codec.Crypto.SimpleAES

Description

A pure interface to AES

Synopsis

Documentation

data Mode Source

Constructors

ECB 
CBC 

data Direction Source

Constructors

Encrypt 
Decrypt 

cryptSource

Arguments

:: Mode 
-> Key

The AES key - 16, 24 or 32 bytes

-> IV 
-> Direction 
-> ByteString

Bytestring 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).