[Haskell-cafe] haskell cryptogaphic libraries
Nils Schweinsberg
ml at n-sch.de
Fri Aug 24 15:00:06 CEST 2012
Am 24.08.2012 14:47, schrieb marcmo:
> * AES Encryption/Decryption (CBC-Mode)
For AES there is the "SimpleAES" package[1] which is super easy to use:
> import qualified Data.ByteString as BS
> import Data.ByteString.Lazy as BL
>
> import Codec.Crypto.SimpleAES
>
> key :: IO Key
> key = BS.readFile "key"
>
> encrypt :: ByteString -> IO ByteString
> encrypt bs = do
> k <- key
> encryptMsg CBC k bs
>
> decrypt :: ByteString -> IO ByteString
> decrypt bs = do
> k <- key
> return $ decryptMsg CBC k bs
(note that the key is a strict ByteString while the encrypted/decrypted
data is lazy)
[1]: http://hackage.haskell.org/package/SimpleAES
More information about the Haskell-Cafe
mailing list