A pure interface to AES
- data Mode
- data Direction
- crypt :: Mode -> ByteString -> ByteString -> Direction -> ByteString -> ByteString
- crypt' :: Mode -> ByteString -> ByteString -> Direction -> ByteString -> ByteString
Documentation
Modes ECB and CBC can only handle full 16-byte frames. This means the length of every strict bytestring passed in must be a multiple of 16; when using lazy bytestrings, its component strict bytestrings must all satisfy this.
Other modes can handle bytestrings of any length. However, encrypting a bytestring of length 5 and then one of length 4 is not the same operation as encrypting a single bytestring of length 9; they are internally padded to a multiple of 16 bytes.
For OFB and CTR, Encrypt and Decrypt are the same operation. For CTR, the IV is the initial value of the counter.
:: Mode | |
-> ByteString | The AES key - 16, 24 or 32 bytes |
-> ByteString | The IV, 16 bytes |
-> Direction | |
-> ByteString | Bytestring to encrypt/decrypt |
-> ByteString |
Encryption/decryption for lazy bytestrings
:: Mode | |
-> ByteString | The AES key - 16, 24 or 32 bytes |
-> ByteString | The IV, 16 bytes |
-> Direction | |
-> ByteString | Bytestring to encrypt/decrypt |
-> ByteString |
Encryption/decryption for strict bytestrings