Copyright | (c) 2013 Stefan Bühler |
---|---|
License | MIT-style (see the file COPYING) |
Maintainer | stbuehler@web.de |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
This module exports the ChaCha-Poly1305 AEAD cipher supported by nettle: http://www.lysator.liu.se/~nisse/nettle/
Both ChaCha (the underlying cipher) and Poly1305 (the keyed hash) were designed by D. J. Bernstein.
- chaChaPoly1305Encrypt :: B.ByteString -> B.ByteString -> B.ByteString -> B.ByteString -> (B.ByteString, B.ByteString)
- chaChaPoly1305Decrypt :: B.ByteString -> B.ByteString -> B.ByteString -> B.ByteString -> B.ByteString -> Maybe B.ByteString
ChaCha-Poly1305
chaChaPoly1305Encrypt Source #
:: B.ByteString |
|
-> B.ByteString |
|
-> B.ByteString |
|
-> B.ByteString |
|
-> (B.ByteString, B.ByteString) | returns ( |
Encrypt plain text and create a verification tag for the encrypted text and some additional data.
key
and nonce
must not be reused together.
The returned tag is 16 bytes long, but may be shortened for verification (losing security).
chaChaPoly1305Decrypt :: B.ByteString -> B.ByteString -> B.ByteString -> B.ByteString -> B.ByteString -> Maybe B.ByteString Source #
Decrypt cipher text and verify a (possible shortened) tag for the encrypted text and some additional data.
key
and nonce
must not be reused together.