indeed a very simple solution for AES!

On Friday, August 24, 2012 3:00:06 PM UTC+2, Nils Schweinsberg wrote:
>
> 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 
>
> _______________________________________________ 
> Haskell-Cafe mailing list 
> haskel...@haskell.org <javascript:> 
> http://www.haskell.org/mailman/listinfo/haskell-cafe 
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to